Restrict from updating field values

arohi
Kilo Expert

1.On an incident form if a check box(u_major_incident) is checked and user is not a member of a specific group(Major incident), restrict from updating urgency and impact field and a 'reopen' button(ui action) and popup a message' Attempts to adjust Impact, Urgency, Reopen on Incidents that are marked as Major Incident can only be done by the Major Incident Team'.

2. And an email should trigger to major incident group with the users name in cc who tried to update field values.

Any help would be appreciated.

Thanks in advance

1 ACCEPTED SOLUTION

You can try the same script in UI Action, I am not sure how priority change logic is added in your Reopen button



if(!gs.hasRole('major_incident_user')){


  gs.addInfoMessage("Attempts to adjust Impact, Urgency, Reopen on Incidents that are marked as Major Incident can only be done by the Major Incident Team");


  gs.eventQueue();


  current.setAbortAction(true);


}





Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

11 REPLIES 11

Alikutty A
Tera Sage

I believe your requirement is to allow users to modify the fields and then prevent its update on UI.



1 & 2.



a) Add a business rule which runs with condition as current.impact.changes() || current.urgency.changes().


b) Create a role for the major incident team say major_incident_user


c) Update the condition field to say u_major_incident== true



Add the following script



if(!gs.hasRole('major_incident_user')){


    gs.addInfoMessage("Attempts to adjust Impact, Urgency, Reopen on Incidents that are marked as Major Incident can only be done by the Major Incident Team");



    var user = current.sys_updated_by;   // You should fetch user's sys_id using: GlideRecord.get('user_name',user);


    var group = 'sys_id_group';     //sys_id of major incident group


    gs.eventQueue('incident.notify', current, group, user); //Trigger notification


    current.setAbortAction(true);   //Aborts update


}




The event should be selected on your notification and you should select event param 1 contains recipient and event param 2 contains recipient. To add the user in CC, you should use additional notification email scripts.




Note: I do not suggest you hard-code the group name instead use roles, Let me know if you need additional info.





Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response


Thanks Alikutty,


I will try this out.


Hi Alikutty,


I'm not sure why but its not working it is showing that alert even foe major incident team member. And set abort action is also not working. changes values are getting saved.


It would be great if you could help.


Alikutty A
Tera Sage

Can you please paste your code?






Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response