Workflow waiting for a timer to finish OR event fired?

Jacob Saaby Ni1
Giga Expert

Hey everyone.

I've run into sort of a peculiar problem:

I want to create a workflow which uses a timer to wait a day, then perform something again.

But if something specific happens in the meantime, it should just end the workflow.

It doesn't seem like that's possible within the workflow? *HINT SERVICENOW - Introduce a multi-action "wait for" activity or action, which lets you wait for multiple types of activities ;)*

So, could a solution be to use a business rule to simply cancel that workflow context? If yes, how do I go about doing that?

Is there a smarter way than doing it this way?

What would your solution be?

1 ACCEPTED SOLUTION

EUREKA!

Oh my god. The answer was RIGHT there in front me the whole time. How could I not be aware of this? I almost facedesked myself when this dawned upon me.

The solution is to use Branch/Join.

Use a Branch activity.

From Branch to a Timer activity.

From Branch to a Wait for condition activity.

From Timer/Wait for condition to where they need to go.

This launches EXACTLY what I needed: It waits for both the timer and the wait for condition. Whatever is true first, cancels the other.

In fact, you don't even have to use branch/join unless you explicitely want to visualize your intentions. Because the workflow behaves as if it's a branch/join, if you drag two lines from the same box to two different activities.

Here's an example. Tested it. Works like a charm, and you don't get 10k activity log lines in your workflow context.

find_real_file.png

View solution in original post

9 REPLIES 9

EUREKA!

Oh my god. The answer was RIGHT there in front me the whole time. How could I not be aware of this? I almost facedesked myself when this dawned upon me.

The solution is to use Branch/Join.

Use a Branch activity.

From Branch to a Timer activity.

From Branch to a Wait for condition activity.

From Timer/Wait for condition to where they need to go.

This launches EXACTLY what I needed: It waits for both the timer and the wait for condition. Whatever is true first, cancels the other.

In fact, you don't even have to use branch/join unless you explicitely want to visualize your intentions. Because the workflow behaves as if it's a branch/join, if you drag two lines from the same box to two different activities.

Here's an example. Tested it. Works like a charm, and you don't get 10k activity log lines in your workflow context.

find_real_file.png

Hi,

 

I am working for the same type of workflow. But instead of "Turnstile", I am using Branch after creating a catalog task and either the branch will check, as whether the task got "Closed Complete" (this update happens in BR, by checking as whether we are getting any comments from user) OR it will wait for 7 days Timer (so having 2 path). I am not using "Join" activity as it will wait for both the path to complete. So I have a "If" condition check for joining both the path so either the task to "Close Complete" or remaining in previous state which I have in task activity.

 

Flow working is good and as expected, the same way as of yours. Either of one path, while the other path will be cancelled. So the "End" activity is also getting cancelled while the flow is complete.

Query is like, whether is it a Best Practice, that the "End" activity is getting Cancelled for a flow. I also don't find any other way to do this checking for 2 conditions at a stage, where after 7 days if still comment is not updated, I need to wait for another 14 days by sending a custom Notification to user. This custom Notification creation I can do it only from Workflow, should not create in table level notifications. 

Jacob Saaby Ni1
Giga Expert

find_real_file.png

Jacob Saaby Ni1
Giga Expert

Just tested it. It works like a charm.

If the cycle of 2880 * 3 * 3 log entries is done, it's potentially a whole lot of log entries on one wf context. But so be it.

Prasanna SV
Tera Contributor

Is there a way we can implement this in flow designer?