How to Auto-close HR cases if they are been in the "Awaiting Acceptance" state for more than 5 business days?

MU1
Tera Contributor

Hi All,

There are multiple snippets of attempted answers scattered across the community forum on this topic.

Can anyone be kind enough to help illustrate the steps involved in configuring the auto-close of HR cases after 5 business days if they have been in "awaiting acceptance" state? Can you please share screenshots of the new System Property and Scheduled Job created to accomplish this task? Many thanks  

1 ACCEPTED SOLUTION

Rob Sestito
Mega Sage

To piggy-back off what Michael said, as he is correct.

When you go to the workflow editor, you will need to checkout the workflow to actually edit the timer.

Just in case you are unsure as how to do so:

  • type workflow edit in your filter nav and click on workflow editor
  • when on the workflow url page, on the right you have your search field, type in HRI to location the workflow Michael mentioned HRI Case User Acceptance
  • click on that workflow, and on the left side of the workflow, use the additional menu options to checkout the workflow

find_real_file.png

 

  • Once checked out by you, locate the Timer step and double-click to get into it

find_real_file.png

 

  • adjust your timer as needed
  • then go back to the addition menu to publish the workflow

(ours as an example)

find_real_file.png

 

Now, someone might need to sanity-check me, but I think once you adjust this timer and republish the workflow, the new timer will only start with NEW cases hitting the conditions. Existing cases already using the previous timer will still use the previous timer.

Please let us know if you need more help with this, or if we have answered your question.

Cheers!

-Rob

View solution in original post

7 REPLIES 7

Sumanth16
Kilo Patron

Hi,

 

You need to create a scheduled job to do this. Create a custom property in the "sys_properties" table. Add integer value "5" in that property.

 

Based on that create scheduled job run periodically (or) daily basis with the following script:

closehr_case();

function closehr_case() {

var cd = gs.getProperty('put your property name here ');
var  ud= parseInt(cd);
if (pn > 0) {

var sh = new GlideRecord('sn_hr_core_case');//add your h
sh.addQuery('state', '6');//replace your awaiting acceptance state value 
sh.addQuery('sys_updated_on', '<', gs.daysAgoStart(cd));
sh.query();
while (sh.next()) {
sh.state = '10';//replace with closed complete value
sh.comments = 'your HR Case automatically closed after ' + ud + ' days in the Awaiting acceptance state.';
sh.active = false;
sh.update();
}
}

 

Please mark it as helpful (or) correct if it helps.

 

Thanks,

Sumanth

MU1
Tera Contributor

Thanks Sumanth.

 

Can you please detail the steps for creating the custom property? Thanks

Hi ,

 

Go to sys_properties.LIST table in left navigator.

 

Click on create and and declare Type as "Integer"  and in the value field put 5.

 

It will work. 

 

If you want example you can check auto close system property in sys_properties table.

 

Please mark it as helpful 9or) correct if it helps.

 

Thanks,

Sumanth

 

 

 

MU1
Tera Contributor

In the code, can you please explain:

if (pn > 0){

What is this line of code doing?

Thanks again.