- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 01:34 AM
I have written a BR in hr task table to close the parent case once the child HR tasks are getting closed. I have written the below script and instead of changing the state to Close Complete the parent case is getting moved to Awaiting Acceptance state. The backend value of Closed complete is 3 and its not taking the value.
(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.state= '3';
hrcase.work_notes = "Case closed as all to-dos are completed";
hrcase.update();
}
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 12:19 AM - edited 10-28-2022 12:20 AM
Hello @Suvetha S,
Please open the HR service record which and select 'Skip Automatic User Acceptance State' in Case Options field. Below is snapshot for reference. You don't need to make nay change in script.
Please mark correct/helpful if it helps you.
Regards,
Vinay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 05:37 AM
Hi,
can you please modify this line and check.
hrcase.state= 3;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 05:55 AM
Tried. Still the same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 12:19 AM - edited 10-28-2022 12:20 AM
Hello @Suvetha S,
Please open the HR service record which and select 'Skip Automatic User Acceptance State' in Case Options field. Below is snapshot for reference. You don't need to make nay change in script.
Please mark correct/helpful if it helps you.
Regards,
Vinay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2022 11:59 PM
Thank You Vinay. It worked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2022 12:04 AM
Hello Suvetha,
Could you please mark answer to helpful.
Regards,
Vinay