field should be display if logged in user have itil role only

Mayur
Tera Contributor

 

Mayur_1-1723469772169.png

I gave a requirement that, as you can see in screenshot, if logged in user has itil role then only assign to self field should display and in assignment group field only those group should be populate in which logged in user is present. For this I write a script include and now want to execute role requirement for that i try client script but fails. Please provide me a suggestion so that i can do that and script should not be conflicted. 

2 REPLIES 2

Bhavani Shankar
Tera Guru

Hello @Mayur,

 

For the variable in question try to add a read role in permission tab of the variable form, like this

BhavaniShankar_0-1723471665929.png

 

If my response helped please do leave a thumbs up.

 

Regards, 

Bhavani Shankar

Regards,
Bhavani Shankar
Linked In

Ankur Bawiskar
Tera Patron
Tera Patron

@Mayur  

you can use onLoad client script and check logged in user role and show/hide the variable

OR

you can use Read roles on that variable in Permission tab

AnkurBawiskar_0-1723472025666.png

 

for the next requirement you can use advanced ref qualifier and use this to show only groups to which logged in user belongs

javascript: 'sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader