In the incident table assignment group changes to default group

Servicenow de11
Tera Contributor

Hello,

 

I have a requirement that is in the incident table  the assignment group has no group members automactically it will changes to 'Default Fullfiller' assignment group. Can anyone help me the script to achieve this requirement.

 

Thanks in advance

1 ACCEPTED SOLUTION

Hi @Servicenow de11 ,

Create before insert business rule on incident table

AnandKumarP_1-1699601921026.png

 

(function executeRule(current, previous /*null when async*/ ) {

    var getassignmentgroup = current.assignment_group;
    var groupMember = new GlideRecord('sys_user_grmember');
    groupMember.addQuery('group', getassignmentgroup);
    groupMember.addQuery('user.active', true);
    groupMember.query();

    if (!groupMember.next()) {
        current.assignment_group = '';
        current.assignment_group = '3cc3c7680b982300cac6c08393673a03';//craete system propoerty to replace sysid
		current.setWorkflow('false');
		current.update();


    }


})(current, previous);

AnandKumarP_0-1699601890988.png

AnandKumarP_2-1699602049403.png

Please mark it as helpful and solution proposed if its serves your purpose.

Thanks,

Anand

 

View solution in original post

6 REPLIES 6

Anand Kumar P
Giga Patron
Giga Patron

Hi @Servicenow de11 ,
Check the before or after insert business rules on incident table they are setting the default group to Default Fulfiller if no members in existing group.

 

Thanks,

Anand

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Servicenow de11 

when are you planning to set the group?during insert or at some other point of time?

you can use before insert/update BR for this

what script did you start with?

you can query sys_user_grmember to check if any members are present or not and then set the value

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello Ankur,

 

Did not start any script. How to write script for that logic.

 

Thanks

I am planning to set the default group during insert. how to query if any members are present or not?