able to close multiple incident in Main incident

Manohararuna
Tera Contributor

Hello Everyone,

 

         I have one requirement .In incident form having the two files are you able to close the Duplicate Incident?(it's a check box and true/ false type) and Duplicate incident is List type. if i select the multiple incidents in Duplicate incident table after update the main incident form after then selected incidents should all go to close state irrespective state and SLA state of selected incidents in Duplicate incident List type fields.please provide solution this one.

 

Regards,

Manohararuna

Manohararuna_0-1752715769663.png

 

1 ACCEPTED SOLUTION

Chaitanya ILCR
Kilo Patron

Hi @Manohararuna ,

create an after update BR

add a filter condition Duplicate Changes and Are you reporting duplicate incident? IS true

 

ChaitanyaILCR_0-1752716905309.png

ChaitanyaILCR_2-1752717108399.png

 

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

    // Add your code here
    var incGr = new GlideRecord('incident');
    incGr.addEncodedQuery('sys_idIN' + current.getValue('u_duplicate_incident'));
	//replace u_duplicate_incident with Duplicate incident backend name if it's different
    incGr.query();
    while (incGr.next()) {
        incGr.setValue('state', 7);
        incGr.setValue('close_code', 'Duplicate'); //replace with your a choice of close code
        incGr.setValue('close_notes', 'Duplicate of ' + current.getValue('number'));
		//add additional fields if required
        incGr.update();
    }


})(current, previous);

you might have to update the line number 5 and 10 with proper backed names (u_duplicate_incident and Duplicate(choice value)) if those are different in your system

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

7 REPLIES 7

Chaitanya ILCR
Kilo Patron

Hi @Manohararuna ,

create an after update BR

add a filter condition Duplicate Changes and Are you reporting duplicate incident? IS true

 

ChaitanyaILCR_0-1752716905309.png

ChaitanyaILCR_2-1752717108399.png

 

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

    // Add your code here
    var incGr = new GlideRecord('incident');
    incGr.addEncodedQuery('sys_idIN' + current.getValue('u_duplicate_incident'));
	//replace u_duplicate_incident with Duplicate incident backend name if it's different
    incGr.query();
    while (incGr.next()) {
        incGr.setValue('state', 7);
        incGr.setValue('close_code', 'Duplicate'); //replace with your a choice of close code
        incGr.setValue('close_notes', 'Duplicate of ' + current.getValue('number'));
		//add additional fields if required
        incGr.update();
    }


})(current, previous);

you might have to update the line number 5 and 10 with proper backed names (u_duplicate_incident and Duplicate(choice value)) if those are different in your system

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Hello Chaitanya,

 

        as per your solution, we are able to close the only one Duplicate incident at a time.

 

Thanks,

Manohararuna

Hi @Manohararuna 

it should work

 

Please share the screenshots of the BR 

I want to see when to run and the script

 

 

you can also go with Flow Designer 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Hello Chaitanya,

 

         Thanks you so much for your solution.

 

Regards,

Manohararuna