D365 Support With Synchronicity

Recent updates to Microsoft Dynamics 365 have introduced changes that impact the creation of stub and standard users, particularly due to the AllowRoleAssignmentOnDisabledUsersSetting being set to False by default. This change can lead to SQL errors when attempting to create stub users programmatically or via data migration tools such as Echo. In this blog, we will outline the issue, explain its cause, and provide a step-by-step solution using the XRM Toolbox to modify the necessary setting.

Understanding the Issue

When creating stub users in Dynamics 365, if the AllowRoleAssignmentOnDisabledUsersSetting is set to False, the process may fail with an SQL error similar to the following:

Sql error: Statement conflicted with a constraint. The INSERT statement conflicted with the FOREIGN KEY constraint “system_user_roles”.
The conflict occurred in database “db_crmxxxx”, table “dbo.SystemUserBase”, column ‘SystemUserId’.
The statement has been terminated.
CRM ErrorCode: -2147185375 Sql ErrorCode: -2146232060 Sql Number: xxx

Resolution

Solution: Updating the Setting Using XRM Toolbox

Prerequisites

Steps to Update the Setting

  1. Launch XRM Toolbox
    • Open XRM Toolbox and connect to your Dynamics 365 instance using appropriate credentials.
  2. Open the Org Settings Tool
    • In XRM Toolbox, search for and open Org Settings Tool.
  3. Find the Relevant Setting
    • Use the search function within Org Settings Tool to locate AllowRoleAssignmentOnDisabledUsersSetting.
  4. Modify the Setting
    • If the value is False, change it to True.
    • Save the changes and confirm the update

Verification & Testing

  1. Test the user creation process again.
  2. Ensure that the SQL error no longer appears.
  3. If issues persist, verify:
    • The setting was updated and saved.
    • Your XRM Toolbox session was connected to the correct environment.
    • Any caching mechanisms in Dynamics 365 are refreshed.

For further reference, check the Microsoft Support documentation on OrgDBOrgSettings.


Conclusion

Leave a Reply

Your email address will not be published. Required fields are marked *