function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
EdCodeEdCode 

Trailhead-STEP: Sharing Rules for External Users

This Step of the Trailhead "" seams to have a BUG!:

After reviewing the exercise several times, I am getting this error: 
Step not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.QueryException: List has no rows for assignment to SObject

Is any want suffering the same issue?
Any tip?

Thank you very much.
Best Answer chosen by EdCode
Olivier SaierOlivier Saier
It eventually worked for me. I had disabled 2 partner contacts then re-enabled them, and renaming First and last names of the corresponding disabled users fixed it.

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi,

I trust you are doing very well.

It is most likely an org issue. It might possible that there is an existing customization (like Apex or an AppExchange app) that was interfering with the challenge.

I suggest you please use a new Developer Org / Trailhead Playground for validating the challenge. That has fixed a lot of problems for me in the past.


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.

Thanks and Regards,
Khan Anas
EdCodeEdCode
Hi Khan, Thank you very much. Actually, I have already created a second brand new Playground but the issue seems to persist. I haven't tried with a brand new Developer Edition though; I may have to try that (?). Thank you. Regards.
Jon Oddvar Kolnes 11Jon Oddvar Kolnes 11
I'm experiencing the same issue. It's a new Trailhead Playground, and I can't be bothered to create a new playground or a Developer org and then to the whole trail over again...
I've double checked the sharing rules and the public group, and everything seems alright.
Pep_AguiloPep_Aguilo
Hi,

After too many retries, I've missed one of the mains steps "Set Your Org's External Org-Wide Defaults". Just check you've followed all steps, not just "Use Sharing Rules for External Users" step. This was my mistake to get this error.

Regards,

 
Jon Oddvar Kolnes 11Jon Oddvar Kolnes 11
Pep, which of the main steps was that?
I've enabled the external sharing model, and for the Opportunity and 'Account and Contract' objects, I've set the Default Internal Access to Public Read Only and the Default External Access to Private. Still, no acceptance on the sharing rules challenge..
Pep_AguiloPep_Aguilo
Hi Jon,

My mistake was not completing https://trailhead.salesforce.com/content/learn/projects/communities_share_crm_data/set_external_owd part. I've created new Playground and followed each step, and it works now.

Regards,
Jon Oddvar Kolnes 11Jon Oddvar Kolnes 11
Hmm, I've set the OWD exactly as they mention in that step. Still, no success...
Olivier SaierOlivier Saier
It eventually worked for me. I had disabled 2 partner contacts then re-enabled them, and renaming First and last names of the corresponding disabled users fixed it.
This was selected as the best answer
Mario Valerio OttavianiMario Valerio Ottaviani
@Olivier Saier.
Thanks for your suggestion, I followed what you wrote by disabling e re-enabling two partner contact, but also, when I re-enabled the last of the two I got another message error and I had to give a partner manager role instead of the partner user role, and it worked for me.
Henrik Rabell 6Henrik Rabell 6
@Jon Oddvar Kolnes 11
I have the same error as you, and I have double checked everything. Did you find a solution to this Trailhead?
Henrik Rabell 6Henrik Rabell 6
Now I remade everything from scratch with a brand new playground. And then I passed. I think it is the only solution.
manasa udupimanasa udupi
It worked for me when double checked and activated all the partner users. since i had hit a limit on number of active users, a user with Edge Communications Partner Manager was inactive. i activated and checked and it worked!!
Rafael Suarez 40Rafael Suarez 40
Here's a tip;
Trailhead executes its tests under your user's scope.  If you create a debug log, you will be able to see whats wrong. in my case, trailhead executed a bunch of SOQL queries and it failed when it attempted this one and came with NULL results, possibly because the dev who worked exception management on this one got a bit lazy:

SELECT RecordId, MaxAccessLevel, HasReadAccess, HasEditAccess FROM UserRecordAccess WHERE (UserId = :tmpVar1 AND RecordId = :tmpVar2)

In my case:
  • For the 1st module, Salesforce failed to Global Find Sean Forbes's contact. So I created him manually- Bad idea
  • I deleted my Sean Forbes contact later,  when the original just showed up ... but... the user was just deactivated, not deleted.  This gives my org  2 Sean Forbes users, 1 inactive non-withstanding.
  • The trailhead code simply looks for a Sean Forbes. Found the Id for the inactive one, and proceeded to throw our unmanaged exception.
  • Renaming the inactive Sean Forbes and adding a few records using workbench nudged trailhead into giving me the win.   No need to re-do it all again.  
Takeaway?  
Debug Log and find out the root cause for things !
Kumar Vikash 16Kumar Vikash 16
Thank you Rafael Suarez 40,
That totally solved my issue.
Michael D.Michael D.
This worked for me:
1. Renamed the inactive Sean Forbes to XSean XForbes,...
2. I found out that one opp. underneath Express Logistics was owned by an inactive partner community user which was renamed by me before to Rosey Gonzalezy. I changed the owner to an active user.

Crazy but true: Then I got the 100 points and was able to continue.
Shubham Raj 29Shubham Raj 29
It eventually worked for me.
If you have multiple users having same name as mentioned in the module, then just disable duplicate inactive users and renaming First and last names of the corresponding disabled users fixed it.
Huuraayyy...

Hope this would simply fix your problem.
Thayam GuerraThayam Guerra
I did the same steps that Michael D. recommended and worked for me.

Just rename the inactive user with an X in front of the name!
Natacha Joseph 4Natacha Joseph 4
I did the same thing as @Olivier Saier suggested and it worked, thank you !
Rajesh Yandrathi 1Rajesh Yandrathi 1
This worked for me:
1. Renamed the inactive Sean Forbes to XSean XForbes
2. Set Debug Logs - Checked the exception


15:22:32.19 (19949232)|EXECUTION_STARTED
15:22:32.19 (19975519)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
15:22:32.19 (20793033)|VARIABLE_SCOPE_BEGIN|[1]|contacts|List<Contact>|true|false
15:22:32.19 (20909079)|VARIABLE_SCOPE_BEGIN|[7]|opp|Opportunity|true|false
15:22:32.19 (20941265)|VARIABLE_SCOPE_BEGIN|[8]|ura|UserRecordAccess|true|false
15:22:32.19 (20982549)|VARIABLE_SCOPE_BEGIN|[3]|users|List<User>|true|false
15:22:32.19 (21007781)|VARIABLE_SCOPE_BEGIN|[5]|users2|List<User>|true|false
15:22:32.19 (21356112)|HEAP_ALLOCATE|[79]|Bytes:3
15:22:32.19 (21423505)|HEAP_ALLOCATE|[84]|Bytes:152
15:22:32.19 (21443154)|HEAP_ALLOCATE|[399]|Bytes:408
15:22:32.19 (21464462)|HEAP_ALLOCATE|[412]|Bytes:408
15:22:32.19 (21480065)|HEAP_ALLOCATE|[520]|Bytes:48
15:22:32.19 (21510349)|HEAP_ALLOCATE|[139]|Bytes:6
15:22:32.19 (21964936)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:20
15:22:32.19 (22693877)|STATEMENT_EXECUTE|[1]
15:22:32.19 (22973655)|STATEMENT_EXECUTE|[1]
15:22:32.19 (22986089)|HEAP_ALLOCATE|[1]|Bytes:63
15:22:32.19 (23017196)|HEAP_ALLOCATE|[1]|Bytes:4
15:22:32.19 (23126247)|HEAP_ALLOCATE|[52]|Bytes:5
15:22:32.19 (23160985)|HEAP_ALLOCATE|[58]|Bytes:5
15:22:32.19 (23173936)|HEAP_ALLOCATE|[66]|Bytes:7
15:22:32.19 (23968811)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|SELECT accountid FROM contact WHERE name = 'Josh Davis' LIMIT 1
15:22:32.19 (32779568)|SOQL_EXECUTE_END|[1]|Rows:1
15:22:32.19 (32814320)|HEAP_ALLOCATE|[1]|Bytes:8
15:22:32.19 (32845514)|HEAP_ALLOCATE|[1]|Bytes:82
15:22:32.19 (32882383)|HEAP_ALLOCATE|[1]|Bytes:8
15:22:32.19 (33178205)|VARIABLE_ASSIGNMENT|[1]|contacts|[{"AccountId":"0010o00002IUiXCAA1","Id":"0030o00002iYsmoAAC","CurrencyIsoCode":"USD"}]|0x27254947
15:22:32.19 (33308734)|STATEMENT_EXECUTE|[2]
15:22:32.19 (33608865)|STATEMENT_EXECUTE|[3]
15:22:32.19 (33616316)|HEAP_ALLOCATE|[3]|Bytes:54
15:22:32.19 (33639440)|HEAP_ALLOCATE|[3]|Bytes:4
15:22:32.19 (33650813)|HEAP_ALLOCATE|[3]|Bytes:7
15:22:32.19 (33697077)|HEAP_ALLOCATE|[3]|Bytes:16
15:22:32.19 (34129384)|SOQL_EXECUTE_BEGIN|[3]|Aggregations:0|SELECT id FROM user WHERE contactid = :tmpVar1 LIMIT 1
15:22:32.19 (39902106)|SOQL_EXECUTE_END|[3]|Rows:1
15:22:32.19 (39930133)|HEAP_ALLOCATE|[3]|Bytes:8
15:22:32.19 (39963598)|HEAP_ALLOCATE|[3]|Bytes:51
15:22:32.19 (40000393)|HEAP_ALLOCATE|[3]|Bytes:8
15:22:32.19 (40120860)|VARIABLE_ASSIGNMENT|[3]|users|[{"Id":"0050o00000XRPDiAAP","CurrencyIsoCode":"USD"}]|0x61f16ea4
15:22:32.19 (40147455)|STATEMENT_EXECUTE|[4]
15:22:32.19 (40252138)|STATEMENT_EXECUTE|[5]
15:22:32.19 (40258841)|HEAP_ALLOCATE|[5]|Bytes:151
15:22:32.19 (40280075)|HEAP_ALLOCATE|[5]|Bytes:4
15:22:32.19 (40935108)|SOQL_EXECUTE_BEGIN|[5]|Aggregations:0|SELECT name, Id, User.Profile.UserLicense.Name FROM User WHERE (Name IN ('Josh Davis') AND User.Profile.UserLicense.Name = 'Partner Community') LIMIT 1
15:22:32.19 (52187053)|SOQL_EXECUTE_END|[5]|Rows:1
15:22:32.19 (52217363)|HEAP_ALLOCATE|[5]|Bytes:8
15:22:32.19 (52268767)|HEAP_ALLOCATE|[5]|Bytes:263
15:22:32.19 (52316751)|HEAP_ALLOCATE|[5]|Bytes:8
15:22:32.19 (52400489)|VARIABLE_ASSIGNMENT|[5]|users2|[{"Name":"Josh Davis","Id":"0050o00000XRPDiAAP","ProfileId":"00e0o0000037emvAAA","CurrencyIsoCode":"USD","Profile":{"Id":"00e0o0000037emvAAA","UserLicenseId":"1000o0000024KwSAAU","UserLicense":{"Id":"1000o0000024KwSAAU","Name":"Partner Community","TotalLicenses":5}}}]|0x4829923e
15:22:32.19 (52440177)|STATEMENT_EXECUTE|[6]
15:22:32.19 (52560644)|STATEMENT_EXECUTE|[7]
15:22:32.19 (52570674)|HEAP_ALLOCATE|[7]|Bytes:58
15:22:32.19 (52600773)|HEAP_ALLOCATE|[7]|Bytes:4
15:22:32.19 (52918914)|SOQL_EXECUTE_BEGIN|[7]|Aggregations:0|SELECT Id FROM Opportunity WHERE Name = 'Edge SLA' LIMIT 1
15:22:32.19 (58615160)|SOQL_EXECUTE_END|[7]|Rows:0
15:22:32.19 (58672705)|HEAP_ALLOCATE|[7]|Bytes:4
15:22:32.19 (58702682)|HEAP_ALLOCATE|[7]|Bytes:0
15:22:32.19 (58806951)|HEAP_ALLOCATE|[7]|Bytes:4
15:22:32.19 (58823112)|HEAP_ALLOCATE|[7]|Bytes:37
15:22:32.19 (59025391)|HEAP_ALLOCATE|[7]|Bytes:46
15:22:32.19 (59693786)|FATAL_ERROR|System.QueryException: List has no rows for assignment to SObject


SELECT Id FROM Opportunity WHERE Name = 'Edge SLA' LIMIT 1 - This is the error.

Cloned an Opportunity using Edge Installation and named it as Edge SLA and Saved.

Challenge Successful
Anandakumar Shanmugam 25Anandakumar Shanmugam 25
Rajesh Yandrathi 1: Thanks yor trick worked for me
Srinath Vallab 2Srinath Vallab 2
Rafael Suarez 40, 
Thanks for this tip. This tip is helpful to debug any trailhead challenge...
William Lucas Machado 9William Lucas Machado 9
Michael D. , thanks man !!!
Atul Ganorkar 20Atul Ganorkar 20
@Rafael Suarez 40 - yah, that has resolved my issue.  Many thanks.

During the process, I have had indeed too many repeated users created.  And as you said, the Trailhead developer has done a poor job by throwing generic error.
Krista Frank 5Krista Frank 5
I had had an issue when I first activated my accounts as Partners and created the users (needed to go disable the "Minimize the number of roles created, which improves performance by cutting down processing loads" setting to make it actually create the portal roles). I had activated the users, then had to deactivate everyone, reactive the accounts as partners and recreate the users - SO, I had 4 inactive users set to the Partner Community User role. I changed the 4 inactive users to the Silver Partner User role and rechecked, and that did the trick. This particular trail is giving me so many issues because of omitted instructions.