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

Samaksh Wani
Giga Sage
Giga Sage

Hello @srinathgtrk 

 

Can you tell on which event it should trigger.

it will trigger whenever assigned to field changed in incident table.

Share the script, did you pass the sys id of group?


Raghav
MVP 2023

Execute below:

Var grMem  = new GlideRecord('sys_user_grmember');
grMem.addQuery('group.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();
}
}

 


Raghav
MVP 2023