show cancelled incident state only for a process specialist team

raj765_32
Tera Contributor

how to hide a 'cancelled' incident  state option for all other users and show it only for a process specialist team in incident form, i have written a display business rule and a onload client script but whats happening is that when i impersonate process team i can see cancelled option and when i cancel the incident by impersonating process team incident is getting cancelled but when i end inmpersonation incident state is setting to active again 

 

business rule :

 

(function executeRule(current, previous /*null when async*/ ) {
 
    
    g_scratchpad.belongs_to_groups = 'false';
  
    if ((gs.getUser().isMemberOf('9d0a20990a0a3caa003f7be11bb58e93') || gs.getUser().isMemberOf('a0cc6d93db123340d8837fc88c96196e')) ||  gs.getUserID() == 'a0cc6d93db123340d8837fc88c96196e')
{
        g_scratchpad.belongs_to_groups = 'true';
    }
 
})(current, previous);
 
 
client script :
 
function onLoad() {
if(g_scratchpad.belongs_to_groups != 'true')
{
g_form.removeOption('incident_state','15');
}}
 
4 REPLIES 4

Aman Kumar S
Kilo Patron

Hi @raj765_32 

Instead of incident_state, shouldn't you be hiding state field option

g_form.removeOption('state','15');

Best Regards
Aman Kumar

there is no state field either there is incident state field

I am not sure if you have customized the solution here but state should be there, it is task field.

And when you say the state is active again, what does it mean, do you have active state?

When incident has already been canceled, shouldn't it reflect on the form, it should not be available for selection for other users, right

if(g_scratchpad.belongs_to_groups != 'true' && g_form.getValue("incident_state") != "15")
{
g_form.removeOption('incident_state','15');
}

}

Best Regards
Aman Kumar

there is no state field either there is incident state field in incident form, i mean to say that when i impersonated the process team and cancelled the incident, incident is getting cancelled but when i end the impersonation the same incident is showing as active again