incident code error for urgency and impact choice list

Carol2
Tera Contributor

Hi @Ankur Bawiskar 

 

I need your expertise here.

 

I have a requirement to allow only the major incident support group users to log p1 incidents meaning the rest of the users should not see the urgency and impact p1.  The code below doesn't work instead it hides p1 for impact and urgency for the major incident support group. What did I miss?

 

see business rule below i created 

 

(function executeRule(current, previous /*null when async*/) {
g_scratchpad.grp = gs.getUser().isMemberOf('major incident support'); 
})(current, previous);

 

created a client script 

function onLoad() {
   var usr = g_user.getUserID();
   
    if (!g_scratchpad.grp) {
      
        g_form.removeOption("impact", '1'); 
        g_form.removeOption("urgency", '1'); 
	}
}

 

1 ACCEPTED SOLUTION

Hi @Carol2 ,

Business rule type will be display business rule not before business rule which you are using.

Check for the group name is correct.

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

View solution in original post

8 REPLIES 8

Hi @Carol2 ,

Your issue got resolved , If yes please make it as mark as accept solution.

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

@Anand Kumar P 

 

While we are here, I have a follow up question. 

 

Hiding the urgency p1 option for a record producer, how do i go about doing that the p1 is showing when user outside of the major incident support group? this shows when user submits the incident via the portal

 

urgency was created as a variable and mapped to the incident choice table and field to populate the urgency

 

Carol2_0-1732620733583.png

Carol2_2-1732620820801.png

 

Carol2_1-1732620806387.png

 

 

 

 

You will have to create a Catalog client script for the Record producer, and in the script you hide the "high" option in a similar way, like so:

function onLoad() {
      g_form.removeOption('urgency', 1);  // select field name, and option to hide
}

 

OlaN
Giga Sage
Giga Sage

Hi,

It looks correct. Is the Business rule running on "Display" ?

 

Is the name of the group correctly spelled ?