Inkey Solution Logo
banner

Blogs

Waiting workflows using parallel wait branches in Microsoft Dynamics 365 CE/CRM

, May 29, 2019 7404 Views

Waiting workflows in dynamics 365 are best suited in situations when it is required by the process to wait for a specific period of time duration before execution.

Basically, in waiting workflows, there has been always confusion between “Timeout” and “Wait” conditions. This is now pretty much clarified with one of our below requirements in Dynamics CRM.

The business requirement was to trigger the workflow on the create and update of a record, which will then send an email to the owner of a record. But the condition was to send the email only after 2 hours from the actual date and time set on the particular field of a form during record creation. This field may be updated to a new value as well. This forced to trigger the workflow both on create and update of the date field.

This situation arose a new problem that was obvious to happen. For example, when a record is created, our workflow gets triggered and the send mail process will wait in a queue to be executed after 2 hours from the value of the date and time field of the newly created record. Now, if someone updates that record, for example, soon after creating the record if the user identifies that the value of the date and time field is incorrect then, he would update that field. Which will again trigger the workflow and another send mail process will wait in a queue to be executed after 2 hours from the date and time value of the updated field. This lead to send the email more than once to the owner of a record.

The workflow step was created as below in the screenshot:

Below image shows the outcome of the workflow triggering twice and waiting in queue for the resources, that send two emails to the owner:

But I wanted only one email to be sent with the updated date in the date time field, and cancel the previous workflow that was already in a queue.

This was achieved by using one extra field called “count”. This field was incremented by 1, each time the workflow was triggered.

So, the new workflow processes as below in the given steps:

  • The first time, when the record is created, the field “count” gets incremented to 1.
  • There is a wait condition, to check if the count is greater than 1 as below:

  • If the count value >1, then set it back to 1 and stop the workflow with the status as “canceled” as shown below:

  • If the count is not greater than 1, then send the email, using the timeout as shown in the below image, since its a best practice to use “timeout” if waiting for a specific date or time. [Use “wait until”, if waiting for the update of a field value]

  • Step to send the email and reset the count:

Thus the workflow was modified to have parallel wait branches.
Finally, the workflow steps were as shown in the below image:

Hence the latest instance of the process is only available in the waiting queue and the previous ones are canceled as shown below:

I hope this helps you!!

Happy CRMing.


Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox

Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.
https://www.inkeysolutions.com/microsoft-dynamics-365/dynamicscrmaddons/gdpr

Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/view-creator

mm

Inkey

INKEY is your solution partner.
Our focus is to deliver you in-time intelligent innovative solutions ("key") for the problems in hand. Maintaining a quality standard right from the inception of a project is our top most priority.

Our team of talented professionals will execute your projects with dedication and excellence. We take ownership and accountability for the effort that goes into meeting our client’s needs.

Years of experience and proven success of delivering innovative custom solutions.

More posts by

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Drop file here

Would you like to digitize your business and put it on the cloud?
Do you need clear, concise reports for your organization?