Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Child incident's resolved date should be same as the parent incident's resolved date

phr
Tera Contributor

Hi All,

 

I have a requirement that the child incident's resolved date should be same as the Parent incident's resolved date. How to achieve this?

 

Thank you.

 

3 REPLIES 3

Deepak Shaerma
Mega Sage

Hi @phr 

Create a New Business Rule.
Table : Incident
When to run : After Update
Filter : State Changes to Resolved(6)
Advance: tick 

Script: 

 if (current.state == '6' /Resolved/) {
        var resolvedDate = current.resolved_at;
        
        var childInc = new GlideRecord('incident');
        // Query for child incidents, adjust "parent" to your reference field
        childInc.addQuery('parent', current.sys_id);
        childInc.query();
        
        while (childInc.next()) {
            // Set the child incident’s resolved date to match the parent
            childInc.resolved_at = resolvedDate;
            childInc.update();
        }
    }



Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards 
Deepak Sharma 

Thank you, this worked

Hi @phr 

Please mark it as Accepted Solution, this will help others for the same requirement.

Thanks & Regards 

Deepak Sharma