Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Dynamically create a select box based on user roles / groups

Leon Tutte
Giga Guru

Hello everyone,

 

today I got an interesting question. A customer wants to have a dropdown where a user can only select items based on the user's groups or roles. I had the idea of writing the options into a table with a list field that holds the applicable user groups. Then I would potentially use a client script to check the items before displaying them in the select box. 

 

It's just an idea. Has anyone done something like that?

1 REPLY 1

Ankur Bawiskar
Tera Patron

@Leon Tutte 

you list down the choices in Select box and then use onLoad client script to hide the options based on logged in user role or group membership

you can use g_form.removeOption(), g_form.addOption() methods

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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