I would like to make UI Policy Action work only for users with specific roles.

chanken
Tera Contributor

Hi Everyone,

I would like to make UI Policy Action work only for users with specific roles.

I have two roles (Role A, Role B).

I want to set mandatory filed when user having Role B assigns the assignto of   incident to a user who has RoleB.

However, when user having RoleA assigns the assignto of incident to a user who has RoleB, I do not want to set mandatory items.

Is it possible to realize by using a script?

Do you have better solutions?

thanks.

1 ACCEPTED SOLUTION

If you want the UI Policy to be applied for different view then you can just uncheck the Global check box on your UI Policy and then select the view for which you want the UI Policy to be applied.



find_real_file.png


View solution in original post

16 REPLIES 16

Harsh Vardhan
Giga Patron

you can do it through display business rule + onLoad() client script to get the assigned to user value.


then use hasRole('role name') to check if it has this role then make field mandatory .g_form.setMandatory('<field name>',true);



https://www.servicenowguru.com/scripting/user-object-cheat-sheet/


Harsh Vardhan
Giga Patron

you can also achieve it through ui policy.



find_real_file.png



Hope it will help you.



do dot waling in condition.



http://wiki.servicenow.com/index.php?title=Dot-Walking#gsc.tab=0


Remember that ui policies needs the fields to be able to evaluate the conditions... At least last time I checked.


Hi harsh,



Thank you for your reply.


I not want   to set mandatory,when "assigned to.Roles" is ITIL and login user not has ITIL.


I wolud like to know how to setting UI Policy.



I am using a different view for users who have ITIL roles or who do not have ITIL roles.



thanks.