how to copy over assign to and assignment group from primary ticket incident to universal request

flsn2
Tera Expert

Hi guys,

 

When creating a ur and create and incident from the ur. I need to copy some infos when the incident get closed.

 

I'm trying to copy over the assign to and assignment group when the incident state is closed to the ur.

 

So both primary incident ticket and ur gets the same info

 

I did multiple try of business rules but it does not work 

 

any tips ?

5 REPLIES 5

Dhananjay Pawar
Kilo Sage

Hi,

Could you please share your code here.

Thanks.

Maddysunil
Kilo Sage

@flsn2 

Could you please share your script, meanwhile you can follow below sample script:

 

(function executeRule(current, previous /*null when async*/) {
    // Check if the incident state has changed to "Closed"
    if (current.state == '7') { // '7' represents the 'Closed' state in the Incident table
        // Get the parent UR record
        var ur = new GlideRecord('sc_request');
        ur.get('sys_id', current.parent.sys_id); // Assuming the parent field is 'parent' and contains the UR's sys_id

        if (ur.isValid()) {
            // Copy assign to and assignment group information from the closed incident to the UR
            ur.assignment_group = current.assignment_group;
            ur.assigned_to = current.assigned_to;
            ur.update();
        }
    }
})(current, previous);

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

Do i need to put something in the when to run field ?

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @flsn2 

 

Is something at property level did you check.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************