preventing 'repeated runs' setting from triggering a workflow when no change in condition met

Hello,

I am not sure if this has been addressed in other related topics - i searched through and did not find the same exact issue.

The workflows module is great to allow the frontend user to build a workflow – but I have come across an issue with several instances.

If I want a workflow to run more than once - I need to choose ‘repeated runs’.

Here is a Scenario where I would want the workflow to trigger multiple times (ie repeated runs) and the associated issues that I am highlighting :


Let’s say I create a workflow for Opportunities module with a condition set for ‘Sales Stage=Negotiation/Review’ – with an action to send an email to the Sales Manager.

The Sales rep updates an Opportunity to Sales Stage=Negotiation/Review and hits SAVE and the workflow is triggered and the action is executed (email is sent to Sales Manager).

The Sales Rep continues the negotiation with the prospective client, and determines that the expected close date needs to be adjusted and EDITS the record and adjusts the expected close date – the Sales Stage does not change and then hits SAVE.

Then, the client has a shakeup in the personnel, and the sales rep is now dealing has to step back in their sales stage - and they update the Sales Stage = ID Key Decision Makers ---- then the process resumes to the proposal and then we hit ‘Sales Stage=Negotiation/Review’ once again.

Then the Sales Manager would once again get the email notification to notify that the Sales Stage condition has been met.

If I select ‘repeated runs’ ---- the workflow will trigger when the sales rep edits the record to adjust the expected closed date – which is not desired
If I unselect ‘repeated runs’ — the workflow will not trigger when the sales reps updates Sales Stage=Negotiation/Review for the 2nd time - which is not the desired as we do want the workflow to trigger again.

The suggestion here is that the ‘repeated runs’ should have an option to indicate ‘only run if the condition is met due to a change in the condition’ - in otherwise, if the record is ‘SAVED’ and the condition is met - but there was no change from before it was edited, then the workflow should not run.

I am keen to know how others handle this - if I am missing something in how the workflow should be configured to achieve my objective??

Hello Michael

I suggest the best way to deal with this is with an auxiliary custom field. Let’s call it “Manager notified” for example. It defaults to false.

Then your notification workflows (which allow repeated runs) have a condition to only run if it is false. When they finish notifying, they set the field to true.

Finally, you set up a new workflow that changes that flag to false whenever appropriate (for example, when the sales stage goes back to a certain state).

Hello pgr,

This is an interesting workaround - let me process this with my team and see if this is practical.

We may opt to add a feature to the ‘repeated runs’ that only triggers if the condition has been met due to an update to the field — this would avoid having to create custom fields and additional workflows - the one instance we are working on has about 20 workflows in a range of modules - we would need to create a number of custom fields and a new workflow for each.

Regardless, I will first evaluate your suggestion to see if this will meet out needs.

Many thanks.

I didn’t look at the code, but my guess is that the repeated runs check happens before the actual workflow gets called, not after. So, making it check the conditions would require reverting the way the current code is ordered, which might turn out to be hard, or hurt efficiency.

Another option that occurred to me to design the new feature would be: make a new workflow action called “reset repeated runs [for this record]”. Then you would call that from inside an auxiliary workflow whenever appropriate. it’s basically a more user friendly and cleaner way of implementing the fix I suggested in my first post. Without requiring an extra custom field, which is a nice advantage.

Hi Michael,

Just reading your scenario and workflow conditions, and correct me if I missed that you already set this up.

Are you currently using the “Any Change” condition Type for your workflows?

This Any Change would only trigger if the field in question had been altered. This would satisfy your condition of only wanting to execute the workflow if there was an intentional change of value. This would mean you wouldn’t need to have a change flag (i.e. field) to manually identify that a workflow does/doesn’t need to run.

This example of conditions I think would help you but it doesn’t answer all the scenarios people have. For e.g. if you wanted this same aspect but have a numerical limit on when an action executes then you will need to either have a flag OR use the calculated fields to create a counter. That is where Pedro’s suggestion would be the approach.

Just throwing this out here though, it would be nice to have a BEFORE Condition to state what the value was prior to the workflow kicking off.