- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021 06:05 AM
Hi All -
I am trying to automatically close an HR0 Case with a particular service when all the associated HR Tasks are closed. I have tried the following After Business Rule, along with some others, but they all have the same result.
(function executeRule(current, previous /*null when async*/) {
var hrtask = new GlideRecord('sn_hr_core_task');
hrtask.addQuery('parent',current.parent);
hrtask.addActiveQuery();
hrtask.query();
if(!hrtask.next()){
var hrcase = new GlideRecord('sn_hr_core_case');
hrcase.addActiveQuery();
hrcase.addQuery('sys_id',current.parent);
hrcase.query();
if(hrcase.next()){
hrcase.setValue('state',3);
hrcase.update();
}
}
})(current, previous);
For this particular service, we have tasks that are assigned to the Subject Person and their manager. With this script however, it closes the HR Case when the Managers tasks are closed and the Subject Persons are still in a Ready state. Does anyone have any idea why this would be or have any other ways they have achieved this? Thanks
Solved! Go to Solution.
- Labels:
-
HR Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021 06:12 AM
Hi,
I have shared solution below using flow designer to close parent INC when all child INCs are closed.
Enhance it for your sn_hr_core_task and sn_hr_core_case table
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021 06:12 AM
Hi,
I have shared solution below using flow designer to close parent INC when all child INCs are closed.
Enhance it for your sn_hr_core_task and sn_hr_core_case table
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021 07:13 AM
Easy enough! Thank you for sharing your solution, this did the trick.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021 09:26 PM
Glad to help.
Please mark response helpful as well.
Stay safe.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
