Populate auto assignment group on incident form through record producer

Madhan27
Mega Guru

HI community,

 

I got stuck with an requirement,  where I created a record producer on alert table. When the record producer is updated it will create a record in the "Alert" table. There it will create the incident record as well.

 

I am trying to auto populate the assignment group of the incident record as per the below condition. 

 

  • When the source on the alert table is zabbix. 

 

Madhan27_0-1715106083518.png

 

  • Accordingly it has to populate the assignment group on the incident form as Zabbx.L1 (Group exists)

Madhan27_1-1715106224378.png

 

Need some hints on it, I guess it can be done on BR and client scripts. What's the best practice and need some help on the scripting as well.

 

TIA

#Recordproducer #AlertTable #AutoAssignmentGroup

1 ACCEPTED SOLUTION

Madhan27
Mega Guru
 
Thank You for your response, The ask was achieved with the business rule with the below following script which i used. 
 
(function executeRule(current, previous /*null when async*/ ) {

 

    var grInc = new GlideRecord('incident');
    grInc.addQuery('sys_id', current.incident); //backend name of 'Task' Field

 

    grInc.query();
    if (grInc.next()) {
        var grGroup = new GlideRecord('sys_user_group');
        grGroup.addEncodedQuery('nameSTARTSWITH' + current.source); //backend name of 'Task' Field

 

        grGroup.query();
        if (grGroup.next()) {
            grInc.setValue('assignment_group', grGroup.getUniqueValue());
            grInc.update();
        }
    }




})(current, previous);

View solution in original post

12 REPLIES 12

Hi @Madhan27 ,

 

Okay Then you can create after insert Business rule and in advanced script write the code as below,

 

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

	var gr = new GlideRecord('incident');
	gr.addQuery('sys_id',current.u_task); //backend name of 'Task' Field
	gr.query();
	if(gr.next()){
		gr.assignment_group = '287ee6fea9fe198100ada7950d0b1b73'; // sys id of Group 
		gr.update();
	}

})(current, previous);

 

 

Note: Update the backend names according to yours

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

Ty for your response @swathisarang98 , But you are hard coding the value over there. Ask is that 

for ex : On alert table source = 123

On incident table assignment group has to look up for the 123 group 

 

 On alert table source = 456

On incident table assignment group has to look up for the 456 group 

 

Can you change the script accordingly? 

Hi @Madhan27 ,

 

So source field stores the name of the assignment group ? if not not could you please tell me how many sources are there or can you tell me whether assignment group will have same name  as source field value or start with source name value ?

 

Thanks 

Swathi

Hi @swathisarang98 No source feild wont have the assignment group details. But the assignment group name can start with the source name.

@Madhan27  is there a possibility that there might be multiple group which start with same source name example Zabbix.L1, Zabbix.L2 something like this or only one will be available ? because if there will be multiple assignment group starting with same name as source then it will be difficult to identify which assignment group should be set dynamically, 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang