1
votes

I have a process which fires on the change of custom_status (Status set to 'Awaiting Response'). Process sends two emails after 4 days and 7 days the change was made. Email dates are extracted from custom fields set by a plugin which triggers on custom_status change. So there is a timeout condition which wait for 4 days and them 3 days after that.

Now I have a change request to stop the process if custom_status is changed again (Set to anything other than 'Awaiting Response') with in the waiting period.

Basic idea behind it is if with in last 3 days of waiting custom_status is changed to 'In Process' and changed back to 'Awaiting Response'. A new instance of workflow will kick in and existing process should not be completed. As emails are sent on that date set on change. Both (New & Old) workflow will send the 2nd email. user will recieve 2 emails.

Can anyone suggest me how to achieve this.

Many Thanks

2

2 Answers

4
votes

You don't need code to achieve this, native workflow is just fine.

In your wait condition, add a parallel wait until the custom_status field is not equal to Awaiting Response. Adding a parallel wait is similar to adding an "otherwise" to an IF.

A parallel wait will stop waiting when one or the other condition is met. So this will wait for 3 days or until the status is changed to something other than Awaiting Response, whichever comes sooner. Once the wait is over, then use an IF condition to check the current value of custom_status, and only if it is still Awaiting Response do you send the email (because this tells you it must have stopped waiting due to 3 days expiring, rather than status change.

2
votes

How about a parallel wait condition? Your main wait condition should wait on those two date fields; your parallel wait condition would wait for custom_status to change. If it does, stop the workflow.

Here's a link to a blog that describes using parallel waits to solve a requirement very similar to yours:

http://ashwaniashwin.wordpress.com/tag/microsoft-dynamics-crm-2011-workflow-parallel-wait-branch-conditions/