Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Duplicates record creating in the "sys_user_has_Role"

Yogita11_
Tera Contributor

Hello @all

 

We created a sandbox environment and cloned it from PROD. However, we noticed an issue: Users which are added to a group, the roles associated with that group are not being assigned to the user. If we remove and re-add the user manually, the roles get assigned correctly.

 

To resolve this, we decided to use a script to delete records from the sys_user_grmember table and recreate them. This approach works fine for a single record, but when we remove the limit or increase it to process multiple records, the instance hangs and starts creating thousands of duplicate records in the sys_user_has_role table.

Has anyone faced this issue before or knows how to fix it? Alternatively, we are considering cloning the instance again, but we need confirm clone configuration details so that will restore all data and ensure that roles assigned through groups work as expected.

 

Thank you

1 REPLY 1

SanjivMeher
Mega Patron
Mega Patron

Is the table sys_user_has_role excluded from clone. I would suggest checking the Exclude tables.

 

SanjivMeher_0-1764615926632.png

 

Also, if you want to use script, can you post your script here to validate?


Please mark this response as correct or helpful if it assisted you with your question.