What is a workflow in Dynamics 365?

workflow in Dynamics 365 is a series of functions or methods, called steps, that are performed sequentially. The Workflow can change the processing direction by using conditionals, referred to as conditional branches.

A workflow is an excellent tool for managing both data and processes. Using workflow rules in Dynamics 365, we can easily ensure that certain steps are followed and that required business processes are executed. Workflow in Dynamics 365 are two types : Asynchronous workflows and Real-time (synchronous) workflows. 

Asynchronous workflows

Asynchronous workflows in Microsoft Dynamics 365 uses windows service to act as a host application for the workflow engine to work. This Asynchronous workflows must be running ton the Windows CRM server, otherwise the workflow won’t execute.

Real-time Workflow

Real-time workflows in Dynamics 365 are also known as Synchronous workflows. These are defined using the workflow entity records and specifically designed for non developers. They execute using the Event Execution Pipeline, much like plug-ins, and they can be executed pre-operation, post-operation, or during the core operation. Also, as with plug-ins, you cannot execute a real-time workflow before the Create operation or after the Delete operation.

  • Real-tine Workflows cancel and roll back the core platform opertaions.
  • Real-tine Workflows can be converted to Asynchronous workflows and vice-versa.

How to create a Workflow in Dynamics 365?

In this Dynamics 365 tutorial, we are going to create a real-time workflow that sends an e-mail to any new students after 2 minutes hours of their records being created. Follow the steps given below to create workflow in Dynamics 365.

  • Navigate to Settings | Solution (Tutorialkart) | Processes | New.
What is a workflow in Dynamics 365
  • Click on the New button.

Defining Workflow properties?

  • Enter process name as “Student Welcome Email“.
  • Now select the category as “Workflow” and uncheck the Run this workflow in the background (recommended) checkbox. If this check box is checked, the Workflow in Dynamics 365 will run as an Asynchronous workflow.
  • Select the Entity as “Student“.
Defining Workflow properties in Dynamics 365
  • Now click on Ok button.

Defining the scope of the Workflow

After creating Process in Dynamics 365, now go to the process name and open the process as shown below.

Defining the scope in Dynamics 365

We cannot run Real-time works in Dynamics 365 before records creation or after record deletion, We can select Record is Created and Record Is Deleted options, but we can’t change the start when the drop-down option is in font of them.

Adding Business logic to Workflow in Dynamics 365

In this step, we are going to add business logic to workflow in Dynamics 365 to send an E-mail to students when their record has been created. As shown below click on Add Step | Wait condition.

Adding business login to a workflow in dynamics 365
  • Click on Wait condition as shown above.
Adding business login to a workflow in dynamics 365

Now we have to add Wait condition, click on <condition> (click to configure) as shown below.

  • Click on Select link.
Adding business login to a workflow in dynamics 365
  • Select Process in the first column.
Adding business login to a workflow in dynamics 365
  • Click on Select to add execution time in the second column.
Adding business login to a workflow in dynamics 365
  • Select Execution Time in the second column.
Adding business login to a workflow in dynamics 365
  • Click on Select link to add Operator in the third column.
Adding business login to a workflow in dynamics 365
  • Select “Equals” in the third column from the drop down list.
Adding business login to a workflow in dynamics 365
  • In the last column, Enter execution value using Form assistance on the right-hand side .
Adding business login to a workflow in dynamics 365

Note : We have to send an E-mail to student wen their new record is created after 2 minutes.

  • Select 2 under minutes.
  • Select after.
  • Select Students entity in Look for process.
  • Click on Record Created and the value will be automatically inserted as shown below.
  • Click on Save and Close button .

Adding Check condition to Workflow in Dynamics 365

After adding Wait for a Workflow in Dynamics 365, we have to add check condition. To add go back in to your process and click on Select this row and Click Add Step under Wait Condition.

As shown in the above Wait condition add all the steps shown below.

  • Click on Save and Close button.

Adding Email properties to a Workflow

After creating Wait condition and Check Condition, finally we have to Add Step to Send email to students. Navigate to Add Step | Click on Send email.

Now a screen will be opened as shown below, Select Create new Message from the drop-down and click on Set Properties.

Adding Email details using Form Assistance

  • Go to To : using form assistance on the right, select Student under Look for followed by Students on the next drop down.
  • Now click on Add button.
  • Finally clic on Ok button.
  • Enter Email Subject and Enter email body as shown above..
  • Finally click on Save and close button.

How to Activate a Workflow in Dynamics 365?

After successfully creating workflow in Dynamics 365, we have to activate a Student Welcome Email workflow. Navigate Settings | Processes | Click on Activate button.

Now a pop-up window will be opened, showing to confirm the process activation.

  • Click on Activate button
  • Finally click on Ok button.

Now the Workflow in Dynamics 365 is activated. When a new student record is created, the Workflow will start waiting. In the above we selected the process as an On-demand process, we have to trigger Workflow manually to send the Welcome email to students.

How to Run Workflow in Dynamics 365?

In this step, we are going to check the working condition of Workflow that we created. Navigate to Student Entity and create a new record.

How to Run Workflow in Dynamics 365
  • open the Record and click on Run Workflow.
Run Workflow in Dynamics 365
  • Select the process name and click on Add button.
  • Click on Ok button.
Run Workflow in Dynamics 365