how to hide/show list collector variable options for only two groups

raj765_32
Tera Contributor

hi can anyone help me for scenario for there is a list collector variable in catalog item with name ' access needed' and it is referencing access table, there are options with name ' okta retail' and ' okta prod' i want to show these two options in list collector variable only for process specilist group memners and service now dev group.

 

i.e 

Only allow ServiceNow Development and Process Specialist groups to see this option in list collector variable and hide from view for all other group members

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@raj765_32 

so if logged in user belongs to Specialist group which values you want to show or hide?

Similarly if logged in user belongs to ServiceNow dev group then which values you want to show/hide?

you can use advanced ref qualifier for this and script include is not required

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

there is already one reference qualifier written for it before
u_active=true^u_name!=MuleSoft API^u_name!=BSM (event monitoring)^u_name!=SiteScope^u_name!=LanDesk

here i have tried writing display business rule and onload client script, but still it is not working

business rule :

(function executeRule(current, previous /*null when async*/ ) {


g_scratchpad.belongs_to_grouppp = 'false';

if ((gs.getUser().isMemberOf('a0cc6d93db123340d8837fc88c96196e')) ||(gs.getUser().isMemberOf('3eb7fbcf0fa7c200abfedb0be1050e20')) ||gs.getUserID() == 'a0cc6d93db123340d8837fc88c96196e') {
g_scratchpad.belongs_to_grouppp = 'true';
}

})(current, previous);

 

client script: 

function onLoad() {
if(g_scratchpad.belongs_to_grouppp != 'true')
{
g_form.removeOption('access_needed','What access do you need?', 'Service Desk OKTA Retail');
g_form.removeOption('access_needed','What access do you need?', 'Service Desk OKTA Admin');
}
else{
g_form.addOption('access_needed','What access do you need?', 'Service Desk OKTA Retail');
g_form.addOption('access_needed','What access do you need?', 'Service Desk OKTA Admin');
}
}