Skip to main content

I have attached a sample diagram of what I am looking to do. One of the activities (Activity 2) calls an external process (smo) and receives some data back.  At the most basic level (and to keep this simple), the data it receives back is either true or false.  If true, the workflow will move on to Activity 3.  So far, so good.

 

What I want to have happen if the data it receives back is false, is to have the activity wait for some interval (like an escalation) and then run that same activity again (Activity 2).  I want it to do that every X minutes for up to Y # of retries (so long as the returned data is false)  If, during the retries, the data comes back true, it will move on to Activity 3.  If, after the last retry, the return data is still false, move the workflow to a different activity, Activity 4.

 

I'm sure this could be done with additional activities and data fields and such, but I am ultimately looking to see if this can be done with only the activities in the diagram using escalations, data fields, or something similar.  If not, then I'd be interested in how you'd go about it another way.

 

Any help you can provide will be greatly appreciated.

 

15534i9C480A4070641B8E.png


15936iBF12F9F486A424FD.png

Hi Mike

 

This would be my approach.

 

Create 3 data fields:

  1. Counter (int) set to 0
  2. Activity2Complete (boolean) set to false
  3. Activity2Start (datetime) set to blank

I am assuming you have another boolean data field that you are returning from the SMO. I will call this "Success" for this example.

 

On the Line from Activity 2 to Activity 3 set the rule that Sucess=True AND Activity2Complete=True

 

On the Line from Activity 2 to Activity 4 set the rule that Sucess=False AND Activity2Complete=True

 

On the Line from Activity 2 back to itself set the rule that  Activty3Complete=False

 

In Activity 1 add a data event at the end of the activity. In this event  add a data transfer to set the value of Activity2Start to Now (look in datetime functions).

 

Open the properties of Activity 2 and set the Start Rule to use Activity2Start as the Start Date.

 

In Activity 2 add a Data Event as the first event. In this event set the Value of Counter to Counter=Counter + 1

 

Then execute your SMO method and return the boolean value

 

Then add another Data Event after the SMO method. Add a transfer data event and set Activity2Complete as the destination.

 

For the source add the following logic in an expression:

    If Success=True OR  (If Success=False AND Counter > uMax Tries] ) Then "True"  ELSE "False". Substitute rMax Tries] with whatever number you want to use.

 

Add another transfer data in this event and set the value of Activity2Start to Activity2Start = Activity2Start + 5 minutes (or however long you want to wait until retrying) using the datetime add minutes function.

 

What you are doing here is checking if we have returned a true value from your SMO, or if you have returned false but reached the maximum attempts, in which case the Activity2Complete value is set to True. Otherwise it is set to False.

 

If Activity2Complete is false, we are going  back to Activity 2 but waiting another 5 minutes before executing.

 

The Line rules will then take care of the logic for you.

 

Hope this helps - let me know if you need clarification.


Great solution.  Thank you!

 


Reply