Update parent task after child deletion
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
what's your business requirement?
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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 .
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya
