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
vineet kumarvineet kumar 

Getting server error while assigning a role to a user

Hello All,

I have a role hierarchy in my SFDC org, I can assign a particular role to a new user but I am getting an error when I am trying to assign that role to a user in a scratch org.  There is no error in Sandbox and Production. Erro is occurring only in Scratch org. 

Let me share with you a dummy hierarchy below
User-added imageSo the issue is with C level (C1,C2,C3) If I assign any of these roles to a user it's giving the below error. This issue is occuring in scratch org, otherwise, in Sandbox and Prod, it's working fine.

User-added image

AbhinavAbhinav (Salesforce Developers) 
Hi Vineet,
Kindly refer below docs:

If it helps,please mark as Best Answer so that it can help others in  future.
ShivankurShivankur (Salesforce Developers) 
Hi Vineet,

I could find that this is a pretty common issue with scratch orgs, particularly if your org is generated with hasSampleData: false.

Please check the discussion and suggestion over similar thread here  (, if it helps.

Hope above information helps, Please mark as Best Answer so that it can help others in the future.