How to cancel timer in flow

SaranyaD3595456
Tera Contributor

Hi,

When sctask state= onhold, substate = waiting for customer, then wait for customer response for 7 days, if no response then the task should be closed automatically, we configured the flow and we are facing issue

  • for example after 2 days, If the state changes from "On Hold" to "In Progress", the active timer should be cancelled.
  • If the state is subsequently set back to "On Hold" with substate "Waiting for Customer", a new 7-day timer should be started.
  • The system should ensure that only one active timer exists at any given time.

what changes should i made in the flow

SaranyaD3595456_0-1777017695360.png

 

SaranyaD3595456_1-1777017753953.png

SaranyaD3595456_2-1777017797269.png

SaranyaD3595456_3-1777017854202.png

 

 

 

1 REPLY 1

Rafael Batistot
Kilo Patron

Hi @SaranyaD3595456 

 

Is better use a business rule to validate the days and after x days, closed as you preferences 

 

See an example of code:

 

Business Rule configuration

  • Table: sc_task
  • When: Before Update

Condition:

current.state.changes() || current.u_substate.changes()

 

Script

var isWaiting = current.state == 'on_hold' && current.u_substate == 'waiting_for_customer';

current.u_waiting_customer_until = isWaiting
? (current.u_waiting_customer_until ? current.u_waiting_customer_until : gs.daysAgoStart(-7))
: '';

 

change the name of field for the correct one.

 

If this response was helpful, please mark it as Helpful and, if applicable, as Correct, this helps other users find accurate and useful information more easily.