Update wait duration on already-running flows

beycos
Tera Contributor

Hello Community,

I have a flow designed for a custom table  where, after a record is submitted, a new record is automatically created 6 months later using a “Wait for ” step in the flow.

Now, I want to change this waiting period from 6 months to 1 year.

The problem is, there are already many submitted records currently waiting based on the old 6-month duration. Even if I update the flow to wait for 1 year, these existing flow executions will still create new records after 6 months, following the original logic. Is it possible to directly update or extend the wait duration on these already-running flows in ServiceNow?

Thanks in advanced 

Beyza

1 ACCEPTED SOLUTION

G Ponsekar
Mega Guru

Hi @beycos ,

 

Potential solutions to extend the wait duration for existing flows:
  • Manually modify scheduled jobs/events (for individual cases):
    • This approach involves identifying and updating the scheduled job (sys_trigger) or event (sysevent) record associated with the waiting flow context.
    • Note: This method is primarily for individual cases during testing or for a very small number of records, as it can be time-consuming for many records.
  • Scripted Approach (for a larger number of records):
    • Identify the records: Use a script to query the relevant custom table and identify the records for which the flows are currently waiting.
    • Cancel existing flow contexts: You'll likely need to cancel the active flow contexts associated with those records.
    • Trigger new flow contexts: After cancellation, you would then need to trigger new flow contexts for those records, which would use the updated flow with the 1-year waiting period.
Important considerations:
  • Impact of interrupting flows: Canceling and restarting flow contexts can impact the overall process. Carefully evaluate the potential consequences before proceeding with this approach.
  • Testing: Regardless of the approach chosen, thoroughly test any changes in a non-production instance before implementing them in production. 
It's important to weigh the effort involved in changing existing flows against the impact of having some records adhere to the old 6-month wait time. For a large number of records, a scripted solution might be necessary, but it requires careful planning and testing.
 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

View solution in original post

3 REPLIES 3

G Ponsekar
Mega Guru

Hi @beycos ,

 

Potential solutions to extend the wait duration for existing flows:
  • Manually modify scheduled jobs/events (for individual cases):
    • This approach involves identifying and updating the scheduled job (sys_trigger) or event (sysevent) record associated with the waiting flow context.
    • Note: This method is primarily for individual cases during testing or for a very small number of records, as it can be time-consuming for many records.
  • Scripted Approach (for a larger number of records):
    • Identify the records: Use a script to query the relevant custom table and identify the records for which the flows are currently waiting.
    • Cancel existing flow contexts: You'll likely need to cancel the active flow contexts associated with those records.
    • Trigger new flow contexts: After cancellation, you would then need to trigger new flow contexts for those records, which would use the updated flow with the 1-year waiting period.
Important considerations:
  • Impact of interrupting flows: Canceling and restarting flow contexts can impact the overall process. Carefully evaluate the potential consequences before proceeding with this approach.
  • Testing: Regardless of the approach chosen, thoroughly test any changes in a non-production instance before implementing them in production. 
It's important to weigh the effort involved in changing existing flows against the impact of having some records adhere to the old 6-month wait time. For a large number of records, a scripted solution might be necessary, but it requires careful planning and testing.
 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

Thank you for your quick response Ponsekar, 

When I update the scheduled job (sys_trigger ) manually, the flow remains in the waiting state and does not create a new record. Do you have any idea why this might be happening? 

Regards and many thanks 

Beyza 

Ankur Bawiskar
Tera Patron
Tera Patron

@beycos 

not possible to update the already executing flow context.

You can try to look for the sys_trigger records etc but it's highly risky task.

Recommendation:

1) let current execution finish as per your logic of 6months

2) Cancel that record and notify the users about the change

3) then create fresh record after 6months for the records on which flow context was running with 6 months

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader