Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Revoke group access based on the incident.

srinathgtrk
Tera Contributor

Hi Everyone,

 

Group: Incident User Group

 

If User is not part of any incident (for example user don't have any incident in his bucket) should be removed from above group (Incident User Group).

 

Thanks,

Srinath Kolipakula

12 REPLIES 12

Raghav Sharma24
Giga Patron

Run below fix script or background script:

 

Var grMem  = new GlideRecord('sys_user_grmember');
grMem.addQuery('sys_id', ' ' ); // Pass the sys_id of Incident User Group
grMem.query();
while(grMem.next())
{
var inc = new GlideRecord('incident');
inc.query('assigned_to',grMem.user);
inc.query();
if(inc.getRowCount==0)
{
grMem.deleteRecord();
}
}

 

NOTE: Please execute the script in PDI or dev instance before executing in prod as this is not tested.

Can I write Business rule at incident table for above solution?

This is a server side script and will run on BR as well, but it depends on your requirement.

 

BR will trigger on insert or update, do you want to trigger it on insert/update of incident?

My suggestion will be to write a scheduled job which runs daily and do this operation in the backend.

 

Hi Raghav,

 

As per my requirement, the user will be removed immediately, the above script is not working for Business rule at incident table, please provide me another script.

 

Thanks,

Srinath 

Share your BR conditions and your script.