How to auto close Request if no action taken after 2 days of Date of Dispatch field?

Rekha Tiwari
Kilo Guru

Hi Team,

I have a Record Producer which is mapping to a table u_physical_security.

Record Producer is having a variable called Date of Dispatch this variable is mapped to u_physical_security table's field Date of Dispatch.

Workflow running for this RP is having three level of approvals and multiple catalog tasks. First approval generated - It got approved then 2nd approval generated - t got approved the 3rd approval generated. After that tasks generated for u_physical_security_task.

 

My requirement is-  If no action is taken after 2 days of Date of Dispatch field then auto close the Physical Security Task and Physical security request.

This action can be on any level of approvals or tasks-  If no action is taken on approval  after 2 days of Date of dispatch then set approval as No longer required and auto close Physical security request. 

if first approval is approved and then no action is taken after 2 days of Date of dispatch on 2nd approval then set approval as No longer required and auto close Physical security request. 

If all approval approved and task generated then if no action is taken after 2 days of Date of dispatch on2nd task then close Physical security task and Physical security request.

 

Please help me to get this 

21 REPLIES 21

Hi,

It is going to right branch for if condition but child task's state is setting to 4 instead Closed Complete and Parent record did not change to Closed Incomplete.

find_real_file.png

 

This is Run Script activity-

find_real_file.png

 

This is Set Value activity-

 

find_real_file.png

for the state value try writing as below

gr.state= '3' ;

 

 

and for closing the current record. sometimes we face issues using set values activity in workflow .

 

so better to add a run script activity and manually query the current record using glidrecord object and close it.

Please mark it as Correct/Helpful If my answer is helpful in any way,

Best regards,

Thameem

 

 

 

Hi @Thameem Ansari S N 

I tried to close Parent request using Run script-

find_real_file.png

 

And also changed line to gr.sate = '3'; to close child task-

find_real_file.png

Still no luck.

@Rekha Tiwari  in the first screen shot i believe you tried to close the current record . please correct me if I'm wrong. 

if its right then in the first screen shot second line it should be current.sys_id  instead of current.parennt

 

also in the second screenshot you are trying to close a child record of current record. there before the gr.update add these two below lines 

gs.info('task closing':+ gr.sys_id)
gr.setWorkflow(false);

here the first line is to check whether the child task is getting closed are not. 

then the second line is to prevent if any BR is interrupting .

 

add this 2 lines befro gr.update in the second screenshot. and let me know the resutl

 

Hi @Thameem Ansari S N 

 

Yes, you are right. In first screenshot I am closing record. So yeah it should be current.sys_id. I have updated it-

find_real_file.png

Below is to close child task so I have updated as below-

find_real_file.png

No log came out-

find_real_file.png

And workflow is showing as task is cancelled- find_real_file.png

 

I think which is correct?