How to show a choice list option only to one group and for rest groups remove that option

priya130
Kilo Contributor

Hi All,

 

How to show a choice list option only to one group and for rest groups remove that option. I did tried by using display BR and client script still getting result, let me know if anything wrong in my script

display business rule:-

Table= sc_cat_item

g_scratchpad.grp = gs.getUser().isMemberOf('grp1' || 'grp2');

 

Onload Client script:-

Table= sc_cat_item

function onLoad() {

if (!g_scratchpad.grp)
{
g_form.removeOption('field_name', 'option');
}
}

2 REPLIES 2

Jaspal Singh
Mega Patron
Mega Patron

Hi Priya,

Try below

 

Table= sc_cat_item

g_scratchpad.grp = gs.getUser().isMemberOf('grp1');

g_scratchpad.grp2 = gs.getUser().isMemberOf('grp2');

 

Onload Client script:-

Table= sc_cat_item

function onLoad() {

if (!g_scratchpad.grp && !g_scratchpad.grp2)
{
g_form.removeOption('field_name', 'option');
}
}

 

Saurav11
Kilo Patron
Kilo Patron

Hello

You can use the below

if(gs.getUser().isMemberOf('ABC') || gs.getUser().isMemberOf('XYZ'))

{

g_scratchpad.member = true;

}

else

{

g_scratchpad.member = false;

}

And OnLoad client script:

if (g_scratchpad.member== true)

{

g_form.removeOption('fieldname', 'VALUE_TO_REMOVE');

}

Please mark answer correct/helpful based on impact