Skip to main content

Security Superbadge -2


Challenge 2: Record-Level Security Settings
I created the three user profiles last time, so the starting point tonight was the next tier of security - roles.  I set up the roles per the provided org chart, making sure to follow the opportunity restrictions from the directions.
Next, I set up the required user and assigned her to the correct profile and role.

Hint:  Use a real email address for Samantha Cordero.  You will need to login as Samantha in order to create an opportunity for her.  While you are at it, go ahead and login to Salesforce1 as Samantha.

Once Salesforce1 is enabled, you can set up the appropriate permissions.  You may want to take take a peek at a Salesforce Knowledge Article.

 
Me - as a Project Manager.

Next, I addressed the special role - Project Managers
Project Managers require a role, permission set, and a  sharing rule.
 Whew!

For the final step, I set up the remaining sharing rules in     order to ensure that users with the Inside Sales profile have access to edit and see all accounts and opportunities.  You can check out my configuration below, but it's burred.  No cheating!

If you get stuck, leave me a comment.
  Trailhead Baby is always happy to help!





Comments

  1. hi
    i assigned field sales profile then also getting error like Challenge Not yet complete... here's what's wrong:
    Could not find a user named Samantha Cordero with the Field Sales User profile

    ReplyDelete
  2. Hi! This may be a silly question, but did you double check the spelling of the user's name? Also, did you clone the "standard" profile to create the custom profile? If you are sure that the user has been created and that she is assigned the correct profile, I would login to Salesforce1 as Samantha and create an opportunity.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Did you assign Samantha the correct role, and login to Salesforce1 as Samantha?
      I doubt that either of these are the issue though. The error message seems to indicate that the checker is not finding the user at all within the Org. If you would like to post a screen shot of Samantha's user profile, I am happy to take a look. Unfortunately, you might need to start over in a fresh Playground. I would start by doing the pre-work such as creating the user, before starting any of the challenge steps.

      Delete
    3. Hi, Trailhead Baby,

      I love your blog. It's superhelpful. I'm tackling the Security Specialist superbadge and I've got a question about your hints in challenge #2. What is salesforce1? Thanks!

      Delete
    4. Salesforce1 = an older name for Salesforce mobile.
      Essentially - login via your phone.

      Makes sense?

      Delete
    5. Yes, thank you so much, Trailhead Baby!

      Delete
    6. what happens if you didn't clone the standard user to create the profile?

      Delete
    7. What happens did you didnt clone standard user as a profile when creating the Field Sales User profile?

      Delete
    8. Then you have to start over by cloning the correct profile.

      Delete
    9. i did all the steps correctly but still getting error like - We can't save this record because the “Opportunity Management” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: REQUIRED_FIELD_MISSING: Required fields are missing: [AccountId]. You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 149889500-31883 (-1839703817

      Delete
    10. this error get during saving opportunity record.. i am struggling to this error...plz help me

      Delete
    11. What are you trying to do? It looks like you may be trying to create an opportunity without the required related account?

      Delete
  3. Hi Baby,

    I'm trying to run the Apex Test but while I have installed the Security Superbadge package, I am unable to select the BeAwesome test. I can find Beawesome in the Apex Classes, but when trying to select a test it shows no tests.

    Is running the test critical to pass step 2?

    Thanks, Tim

    ReplyDelete
    Replies
    1. Great question! I do not know if you "have" to run the tests in order to pass. I did run them.
      Did you navigate to "Apex Test Execution" within setup? If you do not see the tests, you may need to click compile all classes on the apex classes page... reference:
      https://help.salesforce.com/articleView?id=code_test_execution.htm&type=5

      Delete
    2. I'm having a similar issue, although I can run the test I get "Class is not defined as global". Any idea what is going here?

      Thanks
      Dean

      Delete
    3. Hi Dean,
      The class not being defined as global shouldn't impact the challenge.
      Did the tests both pass?

      Delete
    4. I've been racking my brain on this one... Did you figure it out? I remember seeing this "class not defined as global" error one other time, but I can't remember what caused it. Are you still stuck? I'd like help you if you are still there. If you would email me some screenshots I'll take a look- rebecca@capstorm.com

      Delete
    5. Having the same issue as Tim. I did click to compile all classes in Apex but still can't see the BeAwesome test.

      Delete
    6. Hi Andy-

      Is the problem not seeing the BeAwesome test:
      Have you installed the package to your org? The package includes the Apex test that you need. If the package is installed- go to "Apex Test Execution" then select the test.

      Having the class not defined as global should not be an issue- I passed the challenge without tweaking the code add this.

      Is this the correct issue?

      Delete
    7. I'm also having the same issue. I've downloaded the package and can see the Apex class in 'Installed packages' but when I go to run the test, it isn't there.

      The only two tests appearing are 'playground installer' and 'welcome finder'.

      Delete
    8. That's an new one to me! I've done this superbadge twice and not encountered this error. Was the package installed for "all user" or just for the admin? That's the only thing that I can think of... :(

      Delete
    9. I have the same issue. I guess the problem is it´s installed in the org but not shown on the Playground.

      Delete
    10. Looking into this one.... under test classes are you changing the menu to [All Namespaces]?

      Delete
    11. Had same issue - the resolution is to minimize your screen size ("cntr"+"-") up to 75% and restart refresh your page.

      Delete
    12. @unknown you just saved my life. I was about to go insane. Thank you so much!

      Delete
  4. I've managed to pass both tests 2/2 but
    Challenge Not yet complete... here's what's wrong:
    The sharing rule that shares Opportunities owned by Field Sales users with Inside Sales users does not appear to be setup correctly.
    keeps popping up my rules must be correct any ideas on why this is popping up?

    ReplyDelete
    Replies
    1. I'd start by making sure that rolls are set up correctly.
      If you would like to share some details regarding your sharing rule for opportunities, I'm happy to take a look at it.

      Delete
    2. There has to be a sharing rule for Opportunity object that shares records for all roles and subordinates from Inside Sales with Field Sales. That should be Read/Write.

      Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write

      Delete
  5. I am getting exception when I ran BeAwesomw test. I have tried all the mentioned steps
    I am getting system.dml exception
    insert failed. Cannot_Insert_update_Activate_Entity xecm. UserSynchronizationTrigger
    create user:line 147

    ReplyDelete
    Replies
    1. I don't know exactly what would cause this exception. Recommend- reading the instructions for the challenge and double checking to make sure that all steps have been completed. Roles, User, Permission Set, Sharing Rule....

      Delete
  6. I keep getting "The sharing rule that shares Opportunities owned by Field Sales users with Inside Sales users does not appear to be setup correctly." even though I have inserted two Opportunity Sharing Rules :(

    ReplyDelete
    Replies
    1. Would you be able to share some details of the sharing rules that you created?
      (The criteria would be helpful!)

      Delete
    2. Hi there,

      For Sharing rules these are my steps:

      Setup - Sharing Settings - Opportunity Sharing Rule

      > Label: Rule 1
      > Criteria:
      - Type equals Existing Customer - Upgrade
      - Stage equals Closed Won

      >Share with Group: Project Managers
      >Opportunity Access: Read Only


      > Label: Rule 2
      - Opportunity: owned by members of - Role and Subordinates: Sales Executive
      - Share with - Role: Inside_Sales
      > Opportunity Access: Read/Write

      Thank you so much

      (PS Your baby looks really cute!)

      Delete
    3. The good news- I replicated the issue by restarting the superbadge in a new org.
      The bad news- I don't know why the error is showing yet! I'll let you know what I find out!
      (Thanks for the comment on my little guy!) :)

      Delete
    4. Alright! I think I have an answer for you. It's a bit silly, but the order in which the steps are completed seem to really matter for this particular challenge.
      1) Create the 2 sharing rules for Opps
      - Project Managers (read only with criteria)
      - Sales Executives to Inside Sales (read/write)
      What you h ave is perfect.
      2) Do the Apex tests
      3) Create the opportunities under your name
      4) Reassign the opps to Samantha Cordero

      Things have to be done in this specific order... Why? No idea!

      Delete
    5. Thank you so much Trailhead baby, I had everything done correctly, just wrong order. Step 2 now passed!! :-)

      Delete
    6. Hi Trailhead baby,
      I have done everything you said but still getting this error.
      Challenge Not yet complete... here's what's wrong:
      The sharing rule that shares Opportunities owned by Field Sales users with Inside Sales users does not appear to be setup correctly.
      My brain is freezing trying to do this test since few weeks :(

      Thanks

      Delete
  7. Hi Trailhead baby,
    I have the same issue as the person mentioned above, i followed the steps in which you asked to try, but still I get the same error message

    "Challenge Not yet complete... here's what's wrong:
    The sharing rule that shares Opportunities owned by Field Sales users with Inside Sales users does not appear to be setup correctly."

    Sharing Rule 1
    (Opportunity: TypeEQUALSExisting Customer - Upgrade) AND (Opportunity: StageEQUALSClosed Won)
    Group: Project Managers Read Only

    Sharing Rule 2
    Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write

    Any help is highly appreciated. Thanks in advance.

    P.S: I even tried with a new Trialhead Playground following all the steps from scratch but still the same issue persists.

    ReplyDelete
    Replies
    1. The two sharing rules look perfect!
      I have two additional sharing rules related to accounts.

      This error message seems (from my own experience and digging around in the dev community) to occur when the superbadge is not completed in the "correct order." I found the order to be a bit vague in the instructions.

      Once the sharing rules are created (add 2 for accounts)- hint:
      1- Shares with Inside Sales role
      2- Shares with Field Sales role

      - run the apex tests
      - create the opportunities
      - reassign the opportunities to Samantha Cordero

      If you are still stuck after this, just let me know!


      Delete
    2. Thanks for the reply Trailhead Baby,

      I created a sharing rule as below for the account

      Criteria - Owner in Role and Subordinates: Sales Executive
      Share with - Role: Inside Sales
      Account and Contract - Read/Write
      Opportunity - Private
      Case - Private

      But still I get the same error, I'm not sure what is the other sharing rule that should be added for accounts, Could you please guide me with what step I should take further.
      I have another silly question, should we create 2 opportunities ? I have created one and assigned it to Samantha (as below)

      Requirement - Create an opportunity owned by Samantha with the stage name 'Needs Analysis'. Create a Closed Won opportunity owned by Samantha, with the type of 'Existing Customer - Upgrade'.

      Opportunity Details:

      Opportunity Owner - Samantha Cordero
      Opportunity Name - Needs Analysis
      Close Date - 8/12/2019
      Type - Existing Customer - Upgrade
      Stage - Closed Won
      Probability (%) - 100%

      If I had to create the second one please hint me on that.

      Thanks,
      Logan

      Delete
    3. Hi Trailhead baby,
      Ignore my earlier reply. I misread the requirements for creating 2 opportunities. I created 2 opportunities according to the requirement and added a sharing rule on Accounts. I cleared the second step. Thank you very much :)

      Thanks,
      Logan

      Delete
    4. Congrats! The good news- This step seems to be the most difficult part of the challenge! Hopefully you will get the superbadge soon!

      Delete
    5. Thanks Trailhead baby, I got my superbadge :D thanks for your help

      Cheers,
      Logan

      Delete
    6. After all, I created properly I m still getting errors in APEX test execution. Let me just reiterate what I did so far. Please correct me where I went wrong



      1. Created 3 profiles and edited needed settings -- field sales, inside sales, and sales executive.

      2. Created 3 respective roles

      3. Created user Samantha and assigned to Field user profile and Field user role

      4. Installed package

      5. OWD -- Account - Read/write;Opportunity - Private;Case-Private

      6. Created Permission set: Project Manager

      object -- Account : visible and available

      Opportunity : visible and available and object permission : View All



      7.Created Public group : Project Manager and assigned Samantha

      8.Set sharing rule with criteria for type and stage and assign to public group with read only permission in opportunity

      10.Set sharing rule that shares opportunity owned by roles and subordinates of sales executive user with roles of the inside sales user with read/write permission

      11.Set sharing rule that shares account owned by roles and subordinates of sales executive user with roles of the inside sales user with read/write permission

      12.Set sharing rule that shares account owned by roles and subordinates of sales executive user with roles of the field sales user with read/write permission

      13.Run Apex test execution and it fails

      Delete
  8. Hey Trailhead Baby,

    I have followed all the steps but still my test case "Beawesome" is not passing and I cant figure out the reason.

    ReplyDelete
    Replies
    1. Let's talk about the details... Could you share details of your sharing rules? Role setup?

      Delete
    2. I have the same issue, Class is not defined as global. Any ideas?

      Delete
    3. The Apex Class for this superbadge is not defined as global. This message should not impact passing the two tests. Where are you seeing this error message? Is it from the Trailhead challenge checker? On the Apex Test Executiion window, you should see the test methods passed, but I had to go into the Class Summary to get this message - not something you need to do for the superbadge.

      This challenge step will not pass unless you do the following in exact order:
      1) Create the 2 sharing rules for Opps
      2) Do the Apex tests
      3) Create the opportunities under your name
      4) Reassign the opps to Samantha Cordero

      See: https://trailheadbaby.blogspot.com/2018/08/security-specialist-superbadge-1.html

      Delete
    4. The message about the class being global is misleading. The real cause of the problem is that the Apex Test is failing because one of your sharing rules is not set up/ not set up correctly. Drill down on the error on the test to see a more meaningful error message.

      Delete
  9. (Opportunity: TypeEQUALSExisting Customer - Upgrade) AND (Opportunity: StageEQUALSClosed Won) Group: Project Managers Read Only
    Owner in Role and Subordinates: Sales Executives Role: Inside Sales users Read/Write

    ReplyDelete
    Replies
    1. Do you have the sharing rules set up for accounts?

      Delete
  10. Hi,
    I dont see anything under the apex test execution and thats why i cant run the apex test. Could you please help ?

    ReplyDelete
    Replies
    1. Did you search for the tests? Check the instructions - You have to look for the "BeAwesome" test. Was the managed package installed?

      Delete
  11. Hi ,

    I am getting this error after I run the apex test execution. Please help .
    Error : public class BeAwesome
    Class is not defined as global

    ReplyDelete
  12. The Apex Class for this superbadge is not defined as global. This message should not impact passing the two tests. Where are you seeing this error message? Is it from the Trailhead challenge checker? On the Apex Test Executiion window, you should see the test methods passed, but I had to go into the Class Summary to get this message - not something you need to do for the superbadge.

    ReplyDelete
  13. Hi Trailhead baby,

    I created Sharing rules as mentioned below, but still getting this error -"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"

    Setup - Sharing Settings - Opportunity Sharing Rule

    > Label: Project Managers
    > Criteria:
    - Type equals Existing Customer - Upgrade
    - Stage equals Closed Won

    >Share with Group: Project Managers
    >Opportunity Access: Read Only


    > Label: Project Managers2
    - Opportunity: owned by members of - Role and Subordinates: Sales Executive
    - Share with - Role: Inside_Sales
    > Opportunity Access: Read/Write

    Setup - Sharing Settings - Account Sharing Rule
    Label : Project Managers3
    Criteria - Owner in Role and Subordinates: Sales Executive
    Share with - Role: Inside Sales
    Account and Contract - Read/Write
    Opportunity - Private
    Case - Private

    Label : Project Managers4
    Criteria - Owner in Role and Subordinates: Sales Executive
    Share with - Role: Field Sales
    Account and Contract - Read/Write
    Opportunity - Private
    Case - Private

    I executed the sb_security:BeAwesome in Apex Test Execution and saw the error in Apex Test Result.

    Thanks in advance

    ReplyDelete
    Replies
    1. Double check "Project Managers3." A little tweak is needed with opportunity sharing.

      Delete
    2. Firstly appreciated for your response.

      I tried many ways from morning for the whole day & still it is going on.
      Can you please help me clear this stage, not getting what is wrong.

      Tried following the whole comment section above but not able to clear.

      Delete
  14. Take a bow i clear it. Below are the steps. Part of the credit goes to a guy called @themaxworld in SF developer community.

    A big credit for you as well trailhead baby. Thanks again.

    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 2 criteria based sharing rules for Opportunity:

    > Label: Project Managers
    > Criteria:
    - Type equals Existing Customer - Upgrade
    - Stage equals Closed Won

    >Share with Group: Project Managers
    >Opportunity Access: Read Only


    > Label: Project Managers2
    - Opportunity: owned by members of - Role and Subordinates: Sales Executive
    - Share with - Role: Inside_Sales
    > Opportunity Access: Read/Write

    Setup - Sharing Settings - Account Sharing Rule
    Label : Project Managers3
    Criteria - Owner in Role and Subordinates: Sales Executive
    Share with - Role: Inside Sales
    Account and Contract - Read/Write
    Opportunity - Private
    Case - Private

    Label : Project Managers4
    Criteria - Owner in Role and Subordinates: Sales Executive
    Share with - Role: Field Sales
    Account and Contract - Read/Write
    Opportunity - Private
    Case - Private

    With these steps i was able to clear the second step of security specialist superbadge.


    ReplyDelete
    Replies
    1. Hi,
      I have tried everything but still not passing the test. My apex test is passed but still getting the error :(
      Challenge Not yet complete... here's what's wrong:
      The sharing rule that shares Opportunities owned by Field Sales users with Inside Sales users does not appear to be setup correctly.

      Delete
    2. What do you have in your sharing rule?

      Delete
    3. Account Sharing Rules

      Owner in Role and Subordinates: Sales Executive Role: Field Sales Read/Write Private Private
      Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write Private Private

      Opportunity Sharing Rules

      (Opportunity: TypeEQUALSExisting Customer - Upgrade) AND (Opportunity: StageEQUALSClosed Won)
      Group: Project Manager Read Only
      Owner in Role: Field Sales Role: Inside Sales Read/Write
      Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read Only

      Delete
    4. Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write Private Private ----> Account sharing rule. This one is not correct.

      Owner in Role: Field Sales Role: Inside Sales Read/Write
      Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read Only
      ----> Opp sharing rules. There should be 2 total. You have 1 correct with the project managers. The one sharing with Inside Sales is not there yet.

      Delete
    5. I have tried different setting it's not working :(

      Delete
    6. Owner in Role and Subordinates: Sales Executive Role: Field Sales Read/Write Private Private
      Edit | Del Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write Read/Write Private


      (Opportunity: TypeEQUALSExisting Customer - Upgrade) AND (Opportunity: StageEQUALSClosed Won)
      Group: Project Manager Read Only
      Edit | Del Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write

      still same error :(

      Delete
    7. This looks good. Check your OWD.

      This challenge step will not pass unless you do the following in exact order:
      1) Create the 2 sharing rules for Opps
      2) Do the Apex tests
      3) Create the opportunities under your name
      4) Reassign the opps to Samantha Cordero

      Delete
    8. hello Trailhead baby
      Thanks a lot for reply and guiding me. I have done all these steps again but still same error :(.

      Delete
    9. Did you check the OWD? I'd start from the top and make sure all of the security settings are correct..

      Delete
    10. Organization-Wide Defaults

      Lead Public Read/Write/Transfer Public Read/Write/Transfer Checked
      Account and Contract Public Read/Write Public Read/Write Checked
      Opportunity Private Private

      Account:
      Owner in Role and Subordinates: Sales Executive Role: Field Sales Read/Write Private Private
      Owner in Role and Subordinates: Sales Executive Role: Inside Sales User Read/Write Read/Write Private

      Opportunity Sharing Rules

      (Opportunity: StageEQUALSClosed Won) AND (Opportunity: TypeEQUALSExisting Customer - Upgrade)
      Group: Project Managers Read Only
      Owner in Role and Subordinates: Sales Executive Role: Inside Sales User Read/Write

      Delete
    11. Profile Setting:
      Field Sales User:
      Account : read and edit
      Opportunities: Read,Create & Edit

      Inside Sales User:
      Account : Read, Create, Edit
      Opportunities: Read, Create, Edit

      Sales Executive:
      Account : Read, View All
      Opportunities: Read, View All

      Public Group : Project Manager

      Roles :
      Sales Executive

      Field Sales
      Inside Sales User

      Delete
    12. Anything I am missing ??
      Do I have to make any permission set for Field sales user?

      Please help me I am going crazy :(

      Delete
    13. Check the OWD for account...
      Sharing rules are perfect!
      Profiles are perfect!
      No permissions sets needed.

      Delete
  15. Hi There!
    I passed the 2 tests through Apex but continue to get error message:
    Challenge Not yet complete... here's what's wrong:
    Could not find a user named Samantha Cordero with the Field Sales User profile.

    I have tried everything. Logged in as Samantha and set up opps. Nothing has worked.
    It shows successful login history. Any suggestions?

    ReplyDelete
    Replies
    1. Hello! I have not encounter that error before.... I'm sure this is a silly question-- Have you double checked the profile for Samantha Codero? Is she assigned to both the role and the profile? Is the field sales user profile cloned from the "standard profile"?

      Delete
    2. Hi,
      I am facing the same issue. As mentioned by you, I have cloned the Standard User profile assigned the same role. My apex coded ran successfully. Now I'm getting the error - Could not find a user named Samantha Cordero with the Field Sales User profile.

      Delete
    3. Did you create the "Samatha Cordero" user a few times? I'd give it 24 hours then recheck.

      Delete
  16. Do you really *have* to log in as Samantha to create the two opportunities vs. just creating them (from any account) and then assigning ownership to Samantha?

    ReplyDelete
    Replies
    1. Yes, I believe that you do. A user also has to login via mobile in order to set up mobile settings...so I would just login at Samantha via mobile to knock out both items at one time.
      Could I be wrong? Absolutely. This is the way that I did it though both times that I completed this superbadge. Good luck!

      Delete
  17. Hi, When i run the test it fails.

    These are the errors:

    Time Started 5/11/2018 16:16
    Class BeAwesome
    Method Name helpAStranger
    Pass/Fail Fail
    Error Message System.QueryException: List has no rows for assignment to SObject
    Stack Trace Class.sb_security.BeAwesome.createUser: line 133, column 1
    Class.sb_security.BeAwesome.setup: line 124, column 1

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////7
    Time Started 5/11/2018 16:16
    Class BeAwesome
    Method Name hugYourMother
    Pass/Fail Fail
    Error Message System.QueryException: List has no rows for assignment to SObject
    Stack Trace Class.sb_security.BeAwesome.createUser: line 133, column 1
    Class.sb_security.BeAwesome.setup: line 124, column 1

    ///////////////////////////////////////////////////////////////////////////////////

    Previous Config:

    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 2 criteria based sharing rules for Opportunity:

    > Label: Project Managers
    > Criteria:
    - Type equals Existing Customer - Upgrade
    - Stage equals Closed Won

    >Share with Group: Project Managers
    >Opportunity Access: Read Only


    > Label: Project Managers2
    - Opportunity: owned by members of - Role and Subordinates: Sales Executive
    - Share with - Role: Inside_Sales
    > Opportunity Access: Read/Write

    Setup - Sharing Settings - Account Sharing Rule
    Label : Project Managers3
    Criteria - Owner in Role and Subordinates: Sales Executive
    Share with - Role: Inside Sales
    Account and Contract - Read/Write
    Opportunity - Private
    Case - Private

    Label : Project Managers4
    Criteria - Owner in Role and Subordinates: Sales Executive
    Share with - Role: Field Sales
    Account and Contract - Read/Write
    Opportunity - Private
    Case - Private

    ReplyDelete
    Replies
    1. The Account sharing rule, sharing accounts with Inside Sales role- "read/write" on opportunity is not correct.

      Delete
    2. Hello all,

      Wonder if this thread is still active, I came across it when looking to solve an issue i faced in the 2nd step of the "Security Specialist" Superbadge and found that other people faced the same issue but didn't find the answer here.
      Fortunately i managed to find the problem after trying for several days, and i am sharing it with you guys to save you some time, so for people who couldn't pass the tests because of the following error :

      Challenge Not yet complete... here's what's wrong:
      The unit tests in the managed package have not passed successfully. Make sure you run all test in your org before checking this section. Ensure that they all pass.

      And on the developer console the error message :

      System.QueryException: List has no rows for assignment to SObject

      The error message is not precise and the fail message on the challenge is not pointing towards the problem as well.

      And the problem for me was that i had the name of a profile wrong, or at least not as expected by the assertEquals method, i had a profile named "Sales Executive User" instead of "Sale Executive User". And that's why the query was returning no rows in the test and hence the exception.

      Not easy to spot, especially since you don't expect a problem for roles and profiles after you pass the first step, but very easy to solve, so for those of you facing the same exception, verify the names of your roles, profiles, users ... and make sure they match the ones in the challenge.

      Good luck for you all.

      Delete
    3. hiii baby i'm having apex test error for last 2 months can you help me?

      Delete
    4. Everything is done. Still cannot pass it. :(
      I will tell the steps that I have done.
      1) Installed package
      2) Created 3 profiles
      3) Created Roles
      4) Created User Samantha Cordero and assigned proper role and profile.
      5) Created Public group "Project manager"
      6) Made OWD private for Opportunites
      7) Created 2 Opportunity Sharing Rules and 2 Account Sharing rules

      ---Account Sharing Rules---

      Criteria : Owner in Role and Subordinates: Sales Executive User
      Shared With Role: Field Sales User
      Account and Contract : Read/Write
      Contact : Private
      Opportunity : Private
      Case : Private

      Criteria - Owner in Role and Subordinates: Sales Executive User
      Share with - Role: Inside Sales User
      Account and Contract - Read/Write
      Opportunity - Private
      Case - Private
      Contact - Private

      ---Opportunity sharing rules---
      1)
      > Criteria:
      - Type equals Existing Customer - Upgrade
      - Stage equals Closed Won

      >Share with Group: Project Managers
      >Opportunity Access: Read Only


      2)
      Opportunity: owned by members of - Role and Subordinates: Sales Executive
      - Share with - Role: Inside_Sales
      > Opportunity Access: Read/Write

      Apex test Execution
      Cannot find BeAwesome class in [All NameSpaces]

      Kindly help me

      Delete
    5. Everything is done. Still cannot pass it. :(
      I will tell the steps that I have done.
      1) Installed package
      2) Created 3 profiles
      3) Created Roles
      4) Created User Samantha Cordero and assigned proper role and profile.
      5) Created Public group "Project manager"
      6) Made OWD private for Opportunites
      7) Created 2 Opportunity Sharing Rules and 2 Account Sharing rules

      ---Account Sharing Rules---

      Criteria : Owner in Role and Subordinates: Sales Executive User
      Shared With Role: Field Sales User
      Account and Contract : Read/Write
      Contact : Private
      Opportunity : Private
      Case : Private

      Criteria - Owner in Role and Subordinates: Sales Executive User
      Share with - Role: Inside Sales User
      Account and Contract - Read/Write
      Opportunity - Private
      Case - Private
      Contact - Private

      ---Opportunity sharing rules---
      1)
      > Criteria:
      - Type equals Existing Customer - Upgrade
      - Stage equals Closed Won

      >Share with Group: Project Managers
      >Opportunity Access: Read Only


      2)
      Opportunity: owned by members of - Role and Subordinates: Sales Executive
      - Share with - Role: Inside_Sales
      > Opportunity Access: Read/Write

      Apex test Execution
      Cannot find BeAwesome class in [All NameSpaces]

      Delete
    6. One of the sharing rules is incorrect.

      Delete
  18. Hi, i change: The Account sharing rule, sharing accounts with Inside Sales role- "read/write" with "Read Only" and it doesn`t work.

    ReplyDelete
    Replies
    1. "Read Only" for the sharing rule that shares accounts with inside sales is not correct.
      Double check the instructions to see what permissions the inside sales role should have for opportunities.

      Delete
    2. Hi, the test doesn work:

      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 2 criteria based sharing rules for Opportunity:

      > Label: Project Managers
      > Criteria:
      - Type equals Existing Customer - Upgrade
      - Stage equals Closed Won

      >Share with Group: Project Managers
      >Opportunity Access: Read Only


      > Label: Project Managers2
      - Opportunity: owned by members of - Role and Subordinates: Sales Executive
      - Share with - Role: Inside_Sales
      > Opportunity Access: Read/Write

      5. Created 2 criteria based sharing rules for Account:


      Setup - Sharing Settings - Account Sharing Rule
      Label : Project Managers3
      Criteria - Owner in Role and Subordinates: Sales Executive
      Share with - Role: Inside Sales
      Account and Contract - Read/Write
      Opportunity - Read/Write
      Case - Private

      Label : Project Managers4
      Criteria - Owner in Role and Subordinates: Sales Executive
      Share with - Role: Field Sales
      Account and Contract - Read/Write
      Opportunity - Private
      Case - Private


      Delete
    3. I don't see any issues with this-- Are you still getting the same message with the apex tests?

      This post might be helpful:
      https://trailheadbaby.blogspot.com/2018/08/security-specialist-superbadge-1.html

      Delete
    4. Yes, i steel have the same errors, and i do it all again in a new Develop Console.

      Delete
    5. Would you mind emailing me a few screenshots? I'd like to take a look at what you have.
      I've seen this error message before, but I can not remember what triggers it.

      Delete
  19. No problem, I dont´t know your email, can you write me to my email zerfascristian@gmail.com with the screenshots that you need.

    ReplyDelete
    Replies
    1. rebecca@capstorm.com and send me anything you think is applicable. I won't give a "click here" answer, but I'll try to point you in the correct direction.

      Delete
    2. Thanks Rebecca, i just passed the Step 2 and 3. I have a problem with the step 4, i can´t find the "Customer SSN and Bank Account" fields on contact records. I´ve Installed the Trailhead Security superbadge managed package.

      Delete
    3. Perhaps because those fields do not exist- and you can't encrypt a field that doesn't exist.
      (And - HINT! - you shouldn't have to create any fields to pass the challenge.)

      Delete
  20. Hi, I received a message "Challenge Not yet complete... here's what's wrong:
    Could not find a user named Samantha Cordero with the Field Sales User profile." and this persists almost a day... I DID created "Samantha Cordero" and assigned profile "Field Sales User" and role "Field Sales" (I checked the spelling of these again and again), and login by user Samantha Cordero from Salesforce Mobile(iPhone) and there was no problem logging in and view opportunities. Why does this message keep showing? I have read through all the previous comments but no way I could find.
    Someone please help me out!

    ReplyDelete
    Replies
    1. Did you asign her Field User Role ?

      Delete
    2. Was the "Field Sales User" profile created by cloning the Standard Profile?
      I'm happy to take a look at what you have- if you would email a few screenshots to rebecca@capstorm.com

      Delete
  21. Hi Rebecca (Trailhead baby),

    I am having the same issue as Cristian had, I have used the same exact set of instructions mentioned by him, but my apex tests keep failing, I shall also send you screen shots of the same please help me , thanks in advance!

    ReplyDelete
    Replies
    1. Hello! Check the org wide defaults for the account object - if this doesn't solve the issue, I can look a little deeper.

      Delete
  22. Thank you for the quick response Rebecca, in OWD for the "Account and Contract" object I tried all the possible options (Private and Public Read Only) but the same result 'Apex Test Execution' fails both the tests. Please see the screen shots that I have sent you to your mail ID ... Thanks again

    ReplyDelete
    Replies
    1. Giri- Your OWD settings for accounts are not correct in the screenshots that you sent. I also see an issue with a profile.

      Delete
  23. Beating my head against the wall. I tried everything I could think of. I keep getting "The sharing rule that shares 'Closed Won' Opportunities with Project Management users does not appear to be setup correctly." I have created the opportunities owned by Samantha as stated. I have created sharing rules for PM role. I do have sharing rules for Account. Still the same error. I double checked the user name for Samantha. I can't think of anything else to check.
    OWD settings have Opps set to Private and Account set to Public Read Only.

    Account Sharing Rules
    Criteria Shared With Account and Contract Opportunity
    Owner in All Internal Users Role: Field Sales User Read/Write Private
    Owner in All Internal Users Role: Inside Sales User Read/Write Read/Write

    Opportunity Sharing Rules
    Criteria:
    (Opportunity: TypeEQUALSExisting Customer - Upgrade) AND (Opportunity: StageEQUALSClosed Won)
    Shared With: Role: Project Manager User ReadOnly

    Criteria: Owner in All Internal Users Shared With: Role: Sales Executive User Read Only
    Criteria: Owner in All Internal Users Shared With: Role and Subordinates: Inside Sales User Read/Write

    Would greatly appreciate any suggestions

    ReplyDelete
    Replies
    1. Here's a little tip - Project Manager should not be a roll since a person can not have 2 rolls.
      Tip #2: There are 2 sharing rules on opportunity.

      Once you get the Project Manager bit sorted out, feel free to leave a comment with your revised setup, and I'll take a deeper look.

      Delete
  24. Thank you for following up on each one of these comments. I have been stuck for hours and found the answers here. I created my opportunities before I created my Opportunity Sharing Rule. Not sure what is happening under the covers in Salesforce, but the opportunities I created before the sharing rule, were not being shared.

    ReplyDelete
  25. Hello all,
    I also face the problem with Apex failing 2 times
    Error Message System.QueryException: List has no rows for assignment to SObject
    Stack Trace Class.sb_security.BeAwesome.createUser: line 132, column 1
    Class.sb_security.BeAwesome.setup: line 127, column 1

    I named
    roles: Sales Executive, Field Sales, Inside Sales
    profiles: Field Sales User, Inside Sales User, Sales Executive User

    I am pretty sure the configuration is in line with what is recommended above

    ReplyDelete
    Replies
    1. Do you have the sharing rules plus public group?

      Delete
    2. i am facing the same issue both of my apex tests are failing with the same above error and my configuration also matches with above user

      Delete
  26. Hi Trailhead Baby

    I'm stuck on this one too. I have spent HOURS on it. I keep getting failing Apex with error: Error Message System.QueryException: List has no rows for assignment to SObject.

    I have OWD for Account & Contract to Public Read/Write and checked is Grant Access Using Heirarchies
    I have OWD for Opps to Private and checked is grant access using heirarchies

    I have 3 profiles - one for Sales Executive User, one for Inside Sales User, and one for Field Sales Uesr. I have roles for those three as well. I have a Public Group for Project Managers.

    I have three sharing rules.

    Account

    criteria owner in role and subordinates: sales executive user shared with role: inside sales user. read/write, private private.

    Opp
    (opportunity: type equals existing customer-upgrade) and (opp: stage equals closed won) shared with group: project managers, read only

    opp
    owner in role and subordinates: sales exec user shared with role: inside sales user, read/write

    I then ran the tests, failed, but created the opps, reassigned to user: Samantha Cordero. She is assigned as field sales user role and profile. I created the others and assigned them appropriately as well.

    I'm stumped!

    ReplyDelete
    Replies
    1. Two hints:
      * OWD for Account's should not be "public read/write"
      * You will need 2 account sharing rules

      Delete
  27. Ok. I changed OWD for accounts to be public read only.
    Then I added another account sharing rule so now they are as follows - and I'm still failing. :-(


    Owner in Role and Subordinates: Sales Executive User Role: Inside Sales User Read/Write Read/Write Private

    Owner in Role and Subordinates: Sales Executive User Role: Field Sales User Read/Write Private Private

    ReplyDelete
    Replies
    1. hmmmm I do not see any issues. goodness. Are you still getting the same error message with the unit tests?

      Delete
    2. Hi Trailhead Baby - I finally passed! It was the names of my roles. I had Sales Executive User, not Sales Executive, for instance.

      Thank you for all of the help!!!! You're a life saver!

      Delete
  28. Challenge Not yet complete... here's what's wrong:
    The sharing rule that shares Opportunities owned by Field Sales users with Inside Sales users does not appear to be setup correctly.

    Getting this error on Step 2 can't figure it out to save my life - anyone willing to assist :)

    ReplyDelete
    Replies
    1. Sure thing,

      I've set up the 3 profiles.
      I've set up Sam as the only user so far.
      OWD for Ops is Private
      Apex Test's are passing
      My Roles Have Sales Exec Under CEO and then the other two underneath that

      Rule 1 on Ops: (Opportunity: TypeEQUALSExisting Customer - Upgrade) AND (Opportunity: StageEQUALSClosed Won)
      Shared with: Group: Project Manager
      Opportunity: Read Only

      Rule 2 on Ops: Owner in Role and Subordinates: Sales Executive Shared With: Inside Sales Op: Read/Write

      I am using a public group for Project Manager.

      Does there seem to be anything Im missing?

      thank you for responding so fast initially, had not expected :)


      Delete
    2. Looks good- but there are 2 more sharing rules to create on another object. I'd bet you will pass after these are created!

      Delete
  29. Hi! For some reason, when I try to add a user to the Field User profile, no users show up...any ideas??
    There is the option to add new Users, but none o my previous users show up...including Samantha.

    ReplyDelete
    Replies
    1. Are you on the user detail page to add the user to the profile? I'd check the user license....
      It should be "Salesforce." If you picked "Salesforce Platform User"- the profile will not be available.

      Delete
  30. Hi Trailhead baby,

    I have been working on this step 2 for 4 days.. i got stucked with the error "Challenge Not yet complete... here's what's wrong:
    The sharing rule that shares Opportunities owned by Field Sales users with Inside Sales users does not appear to be setup correctly." ... and i have checked dev console its shwing the error "EXCEPTION_THROWN [13]|System.AssertException: Assertion Failed: Expected: 1, Actual: 0" ..

    please help me..and i have tried all the ways

    ReplyDelete
    Replies
    1. Please leave a comment with what you currently have, and I will take a look.

      Delete
  31. Hi team,

    I am on Security superbadge trailhead. I am getting List has no rows for assignment while performing run all tests.

    Class name : sb_security.BeAwesome

    Badge error: Challenge Not yet complete... here's what's wrong:
    The sharing rule that shares Opportunities owned by Field Sales users with Inside Sales users does not appear to be setup correctly.

    Please help me to resolve.

    Thanks,

    ReplyDelete
    Replies
    1. Hi - Unfortunately I'm not a team. Just a solo blogger :) How is your sharing rule set up currently?

      Delete
  32. Hi, I am also struck on the challenge 2 in superbadge:

    Object Default Internal Access Default External Access Grant Access Using Hierarchies
    Account and Contract Public Read Only Public Read Only Checked

    Account sharing rules :
    Edit | Del Owner in Role and Subordinates: Sales Executive Role: Field Sales Read/Write Private Private
    Edit | Del Owner in Role and Subordinates: Sales Executive Role: Inside Sales User Read/Write Read/Write Private

    Oppty sharing rules :

    Object Default Internal Access Default External Access Grant Access Using Hierarchies
    Opportunity Private Private Checked


    Edit | Del
    (Opportunity: Type EQUALS Existing Customer - Upgrade) AND (Opportunity: Stage EQUALS Closed Won)
    Group: Project Managers Read Only
    Edit | Del Owner in Role and Subordinates: Sales Executive Role: Inside Sales User Read/Write


    can u pl;ease help. I am unable to pass this.

    ReplyDelete
    Replies
    1. The positive is that what you have is perfect.... What error message are you receiving?
      I posted about this superbadge twice, so you may also want to reference the newer post. My guess is that you did not do these steps in the exact order:
      1) Sharing Rules

      2) Apex Tests

      3) Create Opportunities

      4 Reassign Opportunities

      Delete
  33. Hi Trailhead Baby,

    For the above challenge two Please find the things I have completed.

    I created User Samantha Cordero and assigned to Field sales profile.
    Created New roles Sales execuitive, Inside sales and Field Sales , assigned Field sales to Samantha.
    Logged in as Samantha and created opportunities.
    Created two sharing rule
    1. Criteria based Type = Existing customer-Upgrade && Stage == Closed Won assign to Role Project managers Group with Read only access
    Created Project manager Group.
    Rule 2
    Based on Owner = Roles and Subordinate = Sales execuitive
    Assign to
    Role = Inside sales
    Read Write permission.

    When i Run test Apex test Execution it failed please see the error message :


    0:00
    sb_security.BeAwesome
    helpAStranger
    Fail
    System.QueryException: List has no rows for assignment to SObject
    Class.sb_security.BeAwesome.createUser: line 133, column 1
    Class.sb_security.BeAwesome.setup: line 127, column 1
    [View]
    0:00
    sb_security.BeAwesome
    hugYourMother
    Fail
    System.QueryException: List has no rows for assignment to SObject
    Class.sb_security.BeAwesome.createUser: line 133, column 1
    Class.sb_security.BeAwesome.setup: line 127, column 1

    ReplyDelete
  34. Hi, the challenge throws following error.


    System.QueryException: List has no rows for assignment to SObject
    Class.sb_security.BeAwesome.createUser: line 133, column 1
    Class.sb_security.BeAwesome.setup: line 127, column 1
    [View]
    0:00
    sb_security.BeAwesome
    hugYourMother
    Fail
    System.QueryException: List has no rows for assignment to SObject
    Class.sb_security.BeAwesome.createUser: line 133, column 1
    Class.sb_security.BeAwesome.setup: line 127, column 1:

    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 2 criteria based sharing rules for Opportunity:

    > Label: Project Managers
    > Criteria:
    - Type equals Existing Customer - Upgrade
    - Stage equals Closed Won

    >Share with Group: Project Managers
    >Opportunity Access: Read Only


    > Label: Project Managers2
    - Opportunity: owned by members of - Role and Subordinates: Sales Executive
    - Share with - Role: Inside_Sales
    > Opportunity Access: Read/Write

    5. Created 2 criteria based sharing rules for Account:


    Setup - Sharing Settings - Account Sharing Rule
    Label : Project Managers3
    Criteria - Owner in Role and Subordinates: Sales Executive
    Share with - Role: Inside Sales
    Account and Contract - Read/Write
    Opportunity - Read/Write
    Case - Private

    Label : Project Managers4
    Criteria - Owner in Role and Subordinates: Sales Executive
    Share with - Role: Field Sales
    Account and Contract - Read/Write
    Opportunity - Private
    Case - Private

    I created two records by logging in as samantha from salesforce mobile .
    I cleared cokkies logged out and logged in to run the test still the same error Test execution is failing.

    ReplyDelete
    Replies
    1. This is a sticky one - I just responded to your email. What you have looks good. What error message is being kicked back when you try to check the challenge?

      Delete
  35. Challenge Not yet complete... here's what's wrong:
    We couldn't find the Sharing Rule that shares Opportunities owned by Field Sales users with Inside Sales users. Please check if the setup of this Sharing Rule is correct.



    Show this error anyone help
    i dont know where i made mistake

    ReplyDelete
    Replies
    1. Share details of your sharing rule, and I'd bet someone can help!

      Delete
    2. I'm not the OP but I'm encountering the same error.
      In my sharing rule, the criteria is "Owner in Role: Field Sales" and "Shared With" is "Role: Inside Sales".

      I also have another similar rule where "Shared With" is "Role and Subordinates: Inside Sales".

      Do help me know what's wrong with my rule(s). Thanks!

      Delete
    3. You should have 4 sharing rules total. None of them have Field Sales sharing with any other role.

      Delete
  36. I was successfully able to create the sharing settings / Samantha User and the Opportunities.
    But when I am trying to run the Apex Test, it gives an error -

    Class.sb_security.BeAwesome.createUser: line 133, column 1.

    Thats the reason when I am trying to check challenge it says -
    Challenge Not yet complete... here's what's wrong:
    The unit tests in the managed package have not passed successfully. Make sure you run all test in your org before checking this section. Ensure that they all pass.

    Can you please help.?

    ReplyDelete
  37. Could you help me about this mistake??

    Apex test: Error message: System.AssertException: Assertion Failed: Inside Sales users should be able to update Accounts owned by Fields Sales and Sales Executive users but the updates failed. #sadtrombone: Expected: 2, Actual: 1

    ReplyDelete
    Replies
    1. I expect that there is an issue with the sharing rules. Would you like to share what you have?

      Delete
  38. Hi, not sure if it has been said, I just wanted to say: you can change the owner of an opportunity once the opportunity is created. No need to log in as Samantha Cordero here. Just create and then change owner :)

    ReplyDelete
  39. I am getting unit test fail error
    System.QueryException: List has no rows for assignment

    ReplyDelete
  40. i am also getting System.QueryException: List has no rows for assignment

    ReplyDelete
    Replies
    1. Did you clone your custom profiles from the standard user profile?

      Delete
  41. Hi
    I have doubt while creating profiles. I created a Profiles under Salesforce licence. But I can assign it to only one user. So I tried to create a different licence for the profile, but each licence doesn't contain a opportunity object. So Can you tell me which Licence is used to create a profile and assign it to the user. Because of this apex test failed and can't pass this challenge.

    ReplyDelete
    Replies
    1. Salesforce user license is correct. Are you using a Trailhead playground org?

      Delete
  42. Hey, thank you for this blog. The developer and official forum posts seem to be taken down. But you can learn a lot from going through issues in a manner such as this, so I appreciate it.

    I was stuck. I'm also still a little uncertain as to why it worked the way it did so hoping to clarify that with any who read this and can give feedback.

    Reading the requirements on the Superbadge I read:
    "Allow access to accounts to anyone in the org, regardless of who owns them, as long as their profile allows access to Accounts in general. Note: keep default options for contacts.
    Note: These general record-level security requirements can be overridden by the more specific requirements set below."

    Now I interpreted this as OWD Account - Public Read.
    I therefore was puzzled when reading the account sharing rules. As the Opportunity sharing rules were the only ones that I felt were required. It didn't help that the error message I was receiving up until the point of me adding the account sharing rules and changing OWD to private was 'Cannot find the sharing rule that shared Field Sales opportunities with Inside Sales'.

    Either way I finally managed to get this working.
    Notes:
    I created profiles from standard user.
    I only changed Sales Executive profile details (view all). (as challenge 1 was complete when I started a new playground, so the profile details were not relevant for step 2 other than existing and view all for sales execs).
    I ended up with x2 sharing rules for Account and x2 for Opportunity
    I added the role hierarchy under CEO, you do not need a clean slate in the role hierarchy e.g. deleting all the roles that exist.
    I didn't login with SF1.

    ReplyDelete
  43. Not to sound like a broken record, but I'm also getting the "Could not find a user named Samantha Cordero with the Field Sales User profile" error message. i've followed along with your other suggestions, and ones on other sites and can't seem to crack this!! Been trying for days and really am dreading starting all over.

    ReplyDelete
  44. Hi if you have problem with " System.QueryException: List has no rows for assignment" on line 133 ... what I identify as usable solution

    1] the flow is really critical :) as is mention above on this page
    2] there need to be created one more Sharing rule for opportunities

    > Label: whatever you want ;)
    - Opportunity: owned by members of - Role: Field Sales
    - Share with - Role: Inside_Sales
    > Opportunity Access: Read/Write

    after I did this -> test works immediately on several playground


    + in case error is on line 132 ... than you have wrond name on profile :)

    ReplyDelete
  45. hi @trailheadbaby

    i am having a problem passing the second apex test case...its been 2 days and i am not able to find any solution!


    Error Message System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [SolarBot__c]: [SolarBot__c]
    Stack Trace Class.sb_security.BeAwesome.hugYourMother: line 72, column 1



    shows this message!

    i would really appreciate if you could help me with this one!

    ReplyDelete
  46. Unable to pass the apex test 1/2, getting below error msg. Tried everything, Please help!
    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
    Stack Trace Class.sb_security.BeAwesome.hugYourMother: line 91, column 1

    ReplyDelete
    Replies
    1. Your sharing rules are probably incorrect.

      Delete
    2. I had tried everything but not able to clear apex test after changing multiple sharing rule.
      Sharing rule means you are talking abt Opportunity Sharing Rules.

      Delete
    3. There should be 4 sharing rules total. 2 on account, 2 on opportunity.

      Delete
  47. Please find the details and let which part needs to corrected, as not able to pass apex test 1/2 having same error:-
    1.Created a user Samantha Cordero assigned with role Field sales & Profile Field sales executive
    2.Created 3 profile
    1>Field Sales User - Accounts & Opportunities- RE & RCE 2>Inside Sales User - Accounts & Opportunities- RCE. 3> Sales Executive User - Accounts & Opportunities - RVA
    3. Created Public Groups - Project Managers - Grant Access Using Hierarchies checked
    4. Created roles Sales Executive - Field Sales - Inside Sales
    5. OWD - Lead Public Read/Write/Transfer, Account and Contract Public Read Only
    Opportunity Private.
    6.Account Sharing Rules -
    Owner in Role and Subordinates: Sales Executive Role: Field Sales Read/Write Private Private
    Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write Read/Write Private
    7. Opportunity Sharing Rules
    (Opportunity: TypeequalsExisting Customer - Upgrade) and (Opportunity: StageequalsClosed Won)
    Group: Project Managers Read Only
    Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write

    Few question - Whether to create sharing opportunity by login as user Samantha, where I don't option to create them. So created by admin account, is it correct?
    And to run apex test do we have to login as Samantha to clear apex, as getting same error running on both user and admin.
    with error msg: - 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


    ReplyDelete
    Replies
    1. Sharing rules look ok. You have to create an opportunity as Samantha by logging in as Samantha. Apex Tests run as your login (admin). I'd double check the roles.

      Delete
  48. Yes opportunity will be created once apex test is passed first right? I'm having an issue with apex test with error mention above. Its been long now, don't know what I'm missing.

    ReplyDelete
  49. Hi,

    I am getting below Error while doing the challenge.

    Challenge Not yet complete... here's what's wrong:
    We couldn't find the Sharing Rule that shares Opportunities owned by Field Sales users with Inside Sales users. Please check if the setup of this Sharing Rule is correct.

    I have tried all the possible solutions provided in the different forum, with different trainheads Please help me with this. I have been working on this from past 3 days still same thing.

    I have done following steps as well.
    1. Navigate to "Sharing Settings"
    2. Edit "Organization-Wide Defaults" and set "Opportunity" to private in the drop-down menu and save.
    3. Scroll down to "Opportunity Sharing Rules" and click "new"
    Rule1.
    1. Label can be anything you like
    2. Rule type = "based on criteria"
    3. Field = Type, Operator = Equals, Value = Existing Customer - Upgrade (the last one will be in the lookup using the icon right next to it)
    - the second field will be: Field = Stage, Operator = Equals, Value = Closed Won (also use the lookup icon)

    ***Make sure you created a public group called "Project Managers" prior to this step if you haven't already***
    4. "Share with" should be "Public Groups" in the first drop-down, and "Project Managers" for the second drop down.
    5. Opportunity access should be set to "read-only"
    Rule 2.
    1. Label can be anything you like
    2. Rule type = "Based on Record Owner"
    3. Opportunity: owned by members of = Roles and Subordinates, and choose Sales Executives for the second drop-down menu
    4. Share with: Roles, and choose Inside Sales Users for the second drop-down menu
    5. Opportunity access should be set to "Read/Write"
    Save both of these rules.
    Type "Apex" into your quick search and choose Apex Test Execution
    - Click Select Tests
    - Choose "All namespaces" from the drop-down menu
    - Choose "BeAwesome" and click run.
    Your results should be 2/2.
    Now navigate to the app launcher, and launch the "Sales" tab, and click on "Opportunities"
    1. Click New
    2. Name the opportunity anything you want
    3. Choose Stage "Needs Analysis"
    4. The close date should be picked as a value in the future.
    5. click save
    6. Create another "New" opportunity and name it anything you'd like again
    7. For type, select "Existing Customer - Upgrade"
    8. Set the date as whatever today's date is
    9. Set the stage to "Closed Won"
    10. Save

    Now we need to make these opportunities owned by your user "Samantha Cordero"
    1. Open the first opportunity you created, and click on the details tab
    2. Under "Opportunity Owner" select "Change Owner" and change it to Samantha Cordero
    3. Repeat steps 1-2 on the second opportunity.

    ReplyDelete
    Replies
    1. I left a note on the 1st comment with this on the other blog post.

      Delete
  50. I just want to say there is a lot of information the correct way to do this. Sharing rules, profiles and obvious things aside this challenge needs to be done in the correct order. I've created 3 Playgrounds and did all the profiles, sharing rules etc the same way except I did it in various orders. If your issue isn't your Apex Test failing then you just did the wrong actions. If you're Apex Test is failing then possibly you did the correct actions but in the wrong order. Plenty of posted above the correct order.

    ReplyDelete
  51. Keep it up, This gives me very useful information. Thanks for sharing this with us. The Desperation in Sales “Make a Customer Not a Sale”

    ReplyDelete
  52. Hi Trailhead Baby,

    I've been trying to complete superbadge2 from 2 days but not able to clear it.
    1- Created 3 profiles.
    2- Created Roles.
    3- Created user "Samantha Cordero" and assigned to appropriate role and profile.
    4) Created Public group "Project manager"
    5) Made OWD private for Opportunites
    6) Created 2 Opportunity Sharing Rules

    ---Opportunity sharing rules---
    1)Criteria: Rule 1
    Type equals Existing Customer - Upgrade
    Stage equals Closed Won
    Share with Group: Project Managers
    Opportunity Access: Read Only

    Criteria: Rule 2
    Opportunity: owned by members of - Role and Subordinates: Sales Executive
    Share with - Role: Inside_Sales
    Opportunity Access: Read/Write

    7- Logged in to salesforce using Samantha user and created mentioned opportunity.

    Problem 1- Ran apex test, but its failing.
    Problem 2 - Clicked on challenge and the error says "We couldn't find the Sharing Rule that shares Opportunities owned by Field Sales users with Inside Sales users. Please check if the setup of this Sharing Rule is correct."

    Please guide me through this and help me in finding the mistake I'm doing.

    ReplyDelete
    Replies
    1. Do you have 4 sharing rules total? Or just 2? You should have 4.

      Delete
    2. Hi Trailhead baby,

      Thanks much for your reply!! I cleared the superbadge challenge 2 test, yeyyyy!!!

      I have created two "Opportunity" sharing rule.
      I found the problem, it was with the "Role" I had created. "Field sales" role and "Inside sales" role wasn't reporting to "Sales executive" role. I recreated the roles as per the requirement and then again assigned to user "Samantha". Recreated the sharing rules and ran apex test, and got result as pass 2/2.

      Delete
  53. I am in challenge 2...Is it required to login as Samantha before creating the opportunity record and testing apex ??

    ReplyDelete

  54. In apex Test one class error is like this:
    Field Sales users should not be able to read Opportunities owned by someone else. However, the test returned records not owned by the user

    ReplyDelete
    Replies
    1. Then there is an issue with the Profile or the Sharing Rule.

      Delete
    2. Hi,
      Am getting the same Error
      My profile settings are:
      Field sales users: Account=R/E,Opp=R/C/E
      Inside Sales Users:Account=R/C/E,Opp=R/C/E
      Sales Executive User:Account=R,View All,Opp=R/View All
      And Sharing rules:
      --Opportunity sharing rules---
      1)Criteria: Rule 1
      Type equals Existing Customer - Upgrade
      Stage equals Closed Won
      Share with Group: Project Managers
      Opportunity Access: Read Only

      Criteria: Rule 2
      Opportunity: owned by members of - Role and Subordinates: Sales Executive
      Share with - Role: Inside_Sales
      Opportunity Access: Read/Write
      Account Sharing Rules -
      Owner in Role and Subordinates: Sales Executive Role: Field Sales Read/Write Private Private
      Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write Read/Write Private
      OWD - Account-Public Read Only
      Opportunity Private.
      After all this getting error as:
      In apex Test one class error is like this:
      Field Sales users should not be able to read Opportunities owned by someone else. However, the test returned records not owned by the user
      Please help me,if anything is wrong
      Thanks

      Delete
    3. What you have looks perfect. Are your rolls set up correctly?

      Delete
    4. Yes I Guess
      Roles: Sales Executive-Users in this role can edit all opportunities associated with accounts that they own, regardless of who owns the opportunities
      Field Sales: Users in this role cannot access opportunities that they do not own that are associated with accounts that they do own
      Inside Sales: Users in this role can edit all opportunities associated with accounts that they own, regardless of who owns the opportunities

      Delete
    5. And Do I need to create oppurtunity record and change the owner to samantha before or after apex test??
      please help me with this .
      Thanks.

      Delete
    6. 2 of the 3 on roles are incorrect

      Delete
    7. Roles: Sales Executive-Users in this role can edit all opportunities associated with accounts that they own, regardless of who owns the opportunities.
      Field Sales: Users in this role cannot access opportunities that they do not own that are associated with accounts that they do own.
      Inside Sales: Users in this role cannot access opportunities that they do not own that are associated with accounts that they do own
      Are these conditions correct??because i tried all the three options on every role but still getting the same error
      In apex Test one class error is like this:
      Field Sales users should not be able to read Opportunities owned by someone else. However, the test returned records not owned by the user
      Please help me
      Thanks

      Delete
    8. 3 out of 3 are incorrect. Please take a little time and carefully read all of the superbadge instructions--- The answers are there, but not super obvious! You can do it! :)

      Delete
    9. Hi,
      Tried all the three options still same error,not getting what is going wrong, got stuck in this from few days..
      Sales Executive: Users in this role can view all opportunities associated with accounts that they own, regardless of who owns the opportunities
      Field Sales:Users in this role can view all opportunities associated with accounts that they own, regardless of who owns the opportunities
      Inside Sales: Users in this role can edit all opportunities associated with accounts that they own, regardless of who owns the opportunities
      In apex Test one class error is like this:
      Field Sales users should not be able to read Opportunities owned by someone else. However, the test returned records not owned by the user
      Please help me
      Thanks

      Delete
    10. Trailhead Baby does not give "answers" because that takes away the challenge from the Superbadge, however, you really really really should do a review of the instructions!

      Delete
  55. Brilliant Article, I am looking for this type of article from many days. Thanks for sharing this with us. Fahim Moledina

    ReplyDelete
  56. Hi,
    I am not able to pass the second apex test even after creating all the 4 sharing rules.
    The error comes out to be like this:
    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

    ReplyDelete
    Replies
    1. This means that there is an issue either in the Profile, Sharing Rules, or Roles. If you want to share what you have, I'll take a look.

      Delete
  57. Account Sharing Rules:
    Owner in Role and Subordinates: Sales Executive Role: Field Sales Read/Write Private Private
    Owner in Role and Subordinates: Sales Executive Role: Inside Sales Read/Write Private Private

    Opportunity Sharing Rules
    (Opportunity: StageEQUALSClosed Won) AND (Opportunity: TypeEQUALSExisting Customer - Upgrade)
    Group: Project Managers Read Only
    Owner in Role and Subordinates: Sales Executive Role: Field Sales Read/Write

    Roles
    Field Sales AND Inside Sales reports to Sales Executive
    Sales Executive reports to GenZ Capital

    Profiles
    I have completed first challenge's requirement based on which profiles were made.

    ReplyDelete
    Replies
    1. Incorrect sharing rule for Inside Sales.

      Delete
    2. Yeah I have corrected it and passed the challenge, Thank you.

      Delete
  58. Hello

    I am unable to pass the one of the apex test cases after creating the sharing rules.

    ReplyDelete
    Replies
    1. System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Opportunity Management” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: REQUIRED_FIELD_MISSING: Required fields are missing: [AccountId]. You can look up ExceptionCode values in the SOAP API Developer Guide.: []
      Class.sb_security.BeAwesome.hugYourMother: line 77, column 1

      Delete
    2. Share what you have and I'll take a look!

      Delete
  59. Hi Trailhead baby...
    I get the below error msg when checking the challenge 2 of Security Specialist.

    Challenge Not yet complete... here's what's wrong:
    The unit tests in the managed package have not passed successfully. Make sure you run all test in your org before checking this section. Ensure that they all pass.

    ReplyDelete
    Replies
    1. What is the result of the package test? Typically the issue is in a profile or one of the sharing rules.

      Delete
  60. 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

    @whoever got this error, the clue is go back to your roles and check that you have created them correctly.
    Hint: Check "reporting to" field.

    Basic mistake but solved the issue and passed the assignment.



    ReplyDelete
  61. Is anyone available to assist here? I am on step 2 of the security specialist superbadge and I am still having a license issue.

    ReplyDelete
  62. This comment has been removed by a blog administrator.

    ReplyDelete
  63. Hii Trailhead baby

    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
    This is my problem .. pls help me

    ReplyDelete
  64. Hi. I realize this is a really newb question, but I'm lost setting up the public group. I can't figure out for the life of me who should be in it. I was thinking role: Project Managers, but there are two problems with that.
    1. I don't know where in the role hierarchy the position would go (nothing says and I can't find the answer online).
    2. The instructions specifically say not to use a role for sharing records with project managers. I realize I could be reading this too literally and that I could accomplish it with sharing rules. But that brings me back to the public group. I'm guessing I still need a role for the project managers to put in the public group for the rule (but then couldn't you just use the role for the sharing rules?). And it also comes back to question 1, where in the role hierarchy do they go?

    ReplyDelete
  65. Techforce services is a Salesforce Consulting Services in Australia Specializing in delivering end to end Salesforce solutions ,Consulting, Implementation DevOps partners in Australia We deliver applications and services more rapidly and reliably, but it’s more than a methodology – it cuts to the very core. Salesforce Data Analytics let us help you become a data driven organization and ensure your data is working hard for your business, This includes implemention
    Salesforce consulting companies
    Salesforce Services
    Staff augmentation companies
    Salesforce integration companies
    Salesforce Implementation services
    Salesforce Health Check
    Salesforce DevOps
    Managed project services

    ReplyDelete
  66. hey i how can i login as samantha and how can i complete security superbadge chanllenge 2 ?

    ReplyDelete
  67. Thanks, it was very tricky part as Apex fail...with errors:
    Class.sb_security.BeAwesome.createUser: line 133, column 1
    Class.sb_security.BeAwesome.setup: line 127, column 1

    until the moment that i created the last missing role of the 3 and i created the role hierarchy (i am not sure if it is necessary but i did). Of course i did all the mentioned steps above.

    ReplyDelete

Post a Comment

Popular posts from this blog

Service Cloud Specialist Superbadge - 4,5,6,7

Part of doing the Service Cloud Specialist superbadge is trying new things, so I am putting up picture of new things that I've tried recently.  One of my favorite new things this week was taking a shower with my whole block collection.  Mom put me in the shower, and I sneaked out to grab the block bin and dumped it in.  I'm concerned to share photos because of the slight nudity, however, I can assure you that it was a glorious adventure.  Instead, I'll share my favorite Saturday new thing- walking to the coffee shop for a sprinkle donut!  Back to the superbadge... Challenge 4 Case Routing If you haven't taken the Onmi Channel module yet, now is a good time! I kept that particular module open one on screen while I walked through this step.  It is hard to give many hints about this step without giving away too many details - so - the best advice is to read through the challenge and label each step with the corresponding Salesforce term.  (IE - "The...

Business Administration Specialist Superbadge- 3 & 4

This afternoon, I added a genius wig in an attempt to look a little older and more experienced.  The free lemonade offer worked!  I made two dollars today!  A huge thank you to Jocelyn Fennewald , Salesforce MVP, for pointing out the "remove all columns" option within the report creator.  When you start a create a new report, simply click to start with a clean screen.  If you are familiar with report and dashboards, this challenge should only take 30 or so minutes to complete.  Below are tips and gotchas for each report / dashboard.  If you need more help, leave a comment! Reports Accounts by Market To create the "Market" row grouping, use a bucket field. Make sure that the correct date range is selected. High Value Residential  This report includes: 1 filter, 1 grouping, and 1 summarized field.  Rated Accounts by State The record count for state and account rating are automatically added. Note the filter.  ...

Service Cloud Specialist Superbadge - 1,2,3

A confession - I know next to nothing about service cloud.  While I was excited that a new superbadge was available, it made me a little nervous that I had to do all of the prerequisites and tackle new things like macros.  New things - new year - let's get started! (Right after I finish guitar practice) If you are also a service cloud novice, the Omni-Channel Basics is a crucial prerequisite even though it is not officially required. Challenge 1 App Appearance  This, like all superbadges, requires a careful read through the instructions prior to any clicking.  I found it helpful to take a separate notebook and write down the steps that I would need for each challenge step - for example -  My rough notes for challenge 1: Create 2 profiles  Tweak service Console 3 new items on utility bar Allow access for new profiles Create User  Beware - After editing the service console, you might have to edit the new profiles.  I found i...