Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Update parent task after child deletion

neelamallik
Tera Contributor
Hi Team, I'm unable to see any changes on Task table and how to check parent
 task could you please clarify this one
(function executeRule(current, previous /*null when async*/) {

    if (current.parent) {
        var parentTask = new GlideRecord('task');
        if(parentTask.get(current.parent)) {
            parentTask.child_count = (parentTask.child_count || 1) - 1;
            parentTask.update();
        }
    }
})(current, previous);
2 REPLIES 2

Ankur Bawiskar
Tera Patron

@neelamallik 

what's your business requirement?

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

Aditya_hublikar
Mega Sage

Hello @neelamallik ,

 

child count is this your custom field ? I checked you code its working in my pdi. what is your when to run type, is it  after delete . I also tried this on incident and child incident its working fine .

 

delete.png
 
delete.png
 
 
 
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya