Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
I'm trying to get the step -2 and while running the supplied Apex Test, 

Getting below error 

ClassBeAwesome

Method NamehugYourMother

Pass/FailFail

Error MessageSystem.QueryException: List has no rows for assignment to SObject

Stack TraceClass.sb_security.BeAwesome.createUser: line 89, column 1

Class.sb_security.BeAwesome.setup: line 81, column 1

I have created the records owned by Samantha as mentioned and also created sharing rule for Project managers.

Can someone please help ?

 
28 answers
  1. Nov 5, 2016, 3:44 PM
    I was able to clear this stage with the following steps (and, I am sure most of these steps you all are following):

    1. OWD settings for Opportunity object is 'Private'

    2. Created public group as 'Project Managers' for Project Manager related requirements.

    3. Setup Profiles and Roles for Field Sales User, Inside Sales User, and Sales Executive User

    4. Created one criteria based sharing rules for Opportunity:

    Criteria: (Opportunity: TypeEQUALSExisting Customer - Upgrade) AND (Opportunity: StageEQUALSClosed Won)

    Shared with: Group: Project Managers

    Access level: Read Only

    5. Then, created another sharing rule for Opportunity (this one I created only after unsuccessful run of the test cases). This sharing rule is owner based, with the following details:

    Criteria: Owner in All Internal Users

    Shared with: Role: Inside Sales

    Access level: Read/Write

    These steps should be enough to complete the stage-2.
  2. Nov 17, 2018, 12:43 AM
    Hello all,

    I am having issues downloading the trailhead security superbadge managed package on a new playground.  Everytime I click the link it wants me to login and takes me to my main playground.  I have everything taken care of for step 2 but obviously the apex tests wont run since i dont have the package installed.  Please help me so i can finally finish this
  3. Nov 3, 2017, 4:52 PM
    I figured out why my apex test only passed 1/2 of the test. Once I gave the inside sales user the View All permission for opportunities I immediatley passed both apex test and completed challenge 2User-added image
  4. Jun 30, 2017, 8:37 AM
    I was getting similar errors. This is how I resolved it.

    1: Created a public group "Project Managers"

    2: Added "Carla Rodriguez" to the "Project Managers" group

    3: Created the following two opportunity Sharing Rules (image attached)

    First Rule Name = Project ManagementCriteria

    (Opportunity: Type = Existing Customer - Upgrade) AND (Opportunity: Stage=Closed Won)

    Share with

    Group: Project Managers

    Opportunity Access

    Read Only

    Second Rule Name = 

    Share with inside salesCriteria

    Owner in Role: Field SalesRole:

    Share with

    Inside Sales

    Opportunity Access

    Read/Write

    Note: Make sure OWD for opportunity is set as "Private

    Opportunity Sharing Rules
  5. May 7, 2022, 11:55 PM

    keep getting this error  Security Specialist 2nd challenge

    1)  3 profiles created

    • Inside Sales User
    • Sales Executive User
    • Field Sales users

    2) 3 Roles Created

    • Sales Executive reporting to CEO
    • Field Sales reporting to Sales Executive
    • Inside Sales reporting to Sales Executive

    3) 2 sharing Rules created

    Field Sales user Samantha Created 2 opportunity 

    and after running the Apex Test Execution it does not pass Please HELP
  6. Dec 30, 2021, 5:49 AM

    hi, i am doing Security Specialist 2nd challange and i got an error in apex test execution can anyone please rectify my error

    error message :-System.AssertException: Assertion Failed: Field Sales users should not be able to read Opportunities owned by someone else. However, the test returned records not owned by the user. ⌗sadtrombone: Expected: 1, Actual: 3

     
  7. Aug 21, 2021, 6:05 PM
    The answer of MaxWorld helped me to pass one test method. It is important to create an opportunity sharing rule that has the following:

    Rule type: Based on record owner

    Opportunity owned by members of Public Groups | All internal users

    Share with: Role Inside Sales Opportunity access: Access Read/Write

    Before I created that sharing rule I was facing the the following error (This is because you might have an opportunity sharing rule that share from field sales to inside sales; i.e: role to role).

    Error

    So I deleted that and created a new one as the user Maxworld suggests

    User-added image

    Also, NOTE that you must have the three roles created, I was missing the Sales Executive role, then run the test and the other test method passed.

    Stay purposeful!
  8. Feb 20, 2021, 11:00 AM
    I was also facing the issue to pass this challenge due to test class failed , in my case it was the spelling error of role Sales Executive , i wrote it Sales Executives and after correction it worked for me. Please make sure about the spellings before passing this challenge. I hope it would help.

    Thanks and Regards,

    Pratiksha Chauhan

     
0/9000