How to cancel timer in flow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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.
