how to manipulate values in dropdown for user depending on role

Snehal13
Kilo Sage

show or hide values in a dropdown based on role of logged in user on load of Incident form. How to achieve this ?

1 REPLY 1

Harish Bainsla
Kilo Patron
Kilo Patron

you can write script

 

if (gs.hasRole("admin")) {
// Set values for admin role
g_form.setOptions("incident_dropdown_field", [
{ value: "value1", displayValue: "Option 1" },
{ value: "value2", displayValue: "Option 2" },
// Add more options as needed
]);
} else if (gs.hasRole("itil")) {
// Set values for itil role
g_form.setOptions("incident_dropdown_field", [
{ value: "value3", displayValue: "Option 3" },
{ value: "value4", displayValue: "Option 4" },
// Add more options as needed
]);
} else {
// Set default values or hide the field
g_form.hideRelatedList("incident_dropdown_field");
}