Assign a user role in an ATF test step

Peter Farr
Giga Contributor

I want to use the ATF to test some business rules and other customizations on the User form. One requires a test to create a user and assign a specific role. I have tried several different ways but I cannot figure out how to do this. Simply doing a "Set field values" on the the User form doesn't work. Can someone point me in the right direction?

1 ACCEPTED SOLUTION

Ankush Agrawal
ServiceNow Employee
ServiceNow Employee

Hi Peter

You can also use 'Record Insert' step. You can insert the data into the table 'sys_user_has_role' with following values:

1. user: sysID of the user

2. role: sysID of the role

3. active: true

--
Best regards
Ankush

P.S. Please mark helpful/correct as appropriate to help fellow Community user in identifying useful answers.

View solution in original post

5 REPLIES 5

Peter Farr
Giga Contributor

Worked a charm. Thanks Ankrush.

 

Actually, both solutions worked, but Ankrush's is a bit easier - no code required.