sc_task autocloser by flow designer

Swagata Banerje
Kilo Explorer

Hi,

I need to autoclose a catalog task after 5 days from the last update (sys_updated_on). Can we do it by Flow Designer?

More details:- 

Lets say, the task is created on 31st Jan. Now if there is no update (sys_updated_on) in that task for continue 5 days, the task will be autoclose on 5th Feb. But if there is any update within 5 days, the timer will count again for 5 days from that particular update time.

The task should be autoclose after 5 days from the last update (sys_updated_on) time.

Please note I need to use Flow Designer and not Work Flow.

 

 

This is what I designed but no luck. 

(Taken 1 min duration for testing)...

 

find_real_file.png

4 REPLIES 4

Swagata Banerje
Kilo Explorer

This is what I designed but no luck. 

(Taken 1 min duration for testing)...

palanikumar
Mega Sage

Instead of this, create a schedule job that runs every hour and close all task that are open and not update for 5 days instead of using Flow. Refer the below script

var queryTime = new GlideDateTime();
queryTime.addDaysUTC(-5); // Update 5 with actual number of days
var gr = new GlideRecord('sc_task');
gr.addQuery('resolved_at', '<', queryTime);
gr.addQuery('state', '1'); // Adding condition to run only for Open task.
gr.query();
while(gr.next(){
   gr.state = '3'; // Update the state to closed complete and update
   gr.update();
}

Thank you,
Palani

Hi palanikumar,

Thanks for your response.

Yes, currently the autocloser of the task achieved by creating schedule job.

But, as we have a proposal to check if we can achieve it by Flow Designer itself, I need suggestion on the same.

Again thanks a lot for sharing your idea.

 

 

 

Cheers...

Swagata

 

 

Muralidharan BS
Mega Sage
Mega Sage

HI Swagata,

 

Can you try this, I have made the flow to run every 1 hour. I think this is more efficient than making the flow to check for 5 non update days to close it. 

Trigger - run every 1 hour

Action - 

1. look up records which are updated before 120 hours

2. For all records from step 1

3. Update the state to closed complete or incomplete based on your logic. 

 

find_real_file.png