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.

Hide Options in the Dropdown of a Field based on User's Role

Bobdevd
Mega Contributor

Hi guys! I am looking into how to go about hiding certain options and making certain options visible in the dropdown of a field based on a certain user's role in a form by scripting it in the Client script in ServiceNow Studio. Here's the scenario:

 

1) I have a field in a form named Machine Process with the field name "machine_process".

 

2) The data type is Choice with 3 choices: "Pending", "Processing" and "Completed". These three choices are in the dropdown of the field "machine_process".

 

3) I have user role: x_7878789_machine.technician

 

4)  If the user's role is "x_7878789_ machine.technician", the word "Pending" from the dropdown of the field "machine_process" is hidden. The only words left visible for the user with the mentioned role to select from the dropdown is "Processing" and "Completed".

How do I go about doing the above in the Client Script using onLoad()? Thank you!

 

 

 

0 REPLIES 0