We first posted this to help our Dynamics 365 to Xero Connector customers but it’s since proved super useful for many others.

There are lots of small enhancements in every day business processes that could make life easier. For example, every time we create an invoice it would be useful for the date to be set automatically or indeed any other values that are always the same.

In Microsoft Dynamics 365 there are different ways to achieve this. You can write a plugin in C#, but this obviously means you must be familiar with C# and Microsoft Dynamics 365 plugins. You can write javascript code, but that means you must know javascript and Microsoft Dynamics 365 UI development. In addition, javascript will not work when you create your invoices with an automated process as it only works on the user interface.

Microsoft has built in something in Dynamics 365 that could be used by non-programmers to create processes that happen for a defined event, for example, creating a new invoice. This feature is called Processes. You can find this option in Dynamics 365 under the Settings menu.

Microsoft Dynamics 365

First, let’s take a look at how Microsoft defines the process categories that are available in Dynamics 365. There are 4 different categories that can be used:

  • Workflow. This process is used to model and automate real world business processes. These processes can be configured to run in the background or in real time and can optionally require user input. Workflow processes can start automatically based on specified conditions or can be started manually by a user.

  • Action. This process is used to create a new operation that is not available in a standard Dynamics 365 for Customer Engagement apps installation or to combine multiple disparate operations into a single operation. For example, in the case of a support call centre, you could combine ‘create’,’assign’, and ‘setstate’ operations into a single new “escalate” operation.

  • Business process flow. This process is used to create a visualization of the business process flow. Users are guided through various stages of the sales or customer service processes. At each stage, you complete specific steps and then move to the next stage. You can customize the process flow by adding or removing steps, changing the order of the stages, or adding new entities to the process flow.

  • Dialog. This process is used to create an interactive step-by-step data entry form that requires user input to start and run to completion. When you start the dialog process, a wizard-like interface is presented so you can make appropriate selections or enter data as you progress through each page of the wizard.

In our example we would like to set the date on every new invoice regardless of any user interaction, e.g. we want the date when the user creates the invoice on the user interface and also when some process generates the invoice. For this task we will use the Workflow type process.

On creation of a new process, the first dialog will ask for the basic information of your new process, such as the name of the process or the category of the process.

business process flow

When you select the category, the part of the dialog under the Category and Entity will be changed based on your chosen category. You can define different values for different categories. In this example you can see what the required settings for a Workflow type process are.

Select the Invoice entity from the dropdown. The next step is to set whether this workflow will be a background process (async) or real-time process (sync).

Run this workflow in the background (recommended)

This option appears when you select workflow as the category. This setting determines whether the workflow is a real-time or background workflow. Real-time workflows run immediately (synchronously) and background workflows run asynchronously. The configuration options available depend on your choice for this setting. Background workflows allow for wait conditions that are not available for real-time workflows. As long as you don’t use those wait conditions, at a later time you can convert background workflows to real-time workflows and real-time workflows to background workflows.

We would like to ensure that the date we set appears immediately, so we untick this option.

The last option you can select on the first dialog is to create the new workflow as a blank workflow or create it from an existing template. Currently we don’t have a template, so I will just go with New blank process option.

When you click Ok, the new workflow will be created and Dynamics 365 will show the Process window and this is where we can define what the real-life business process is that we would like to implement by this new workflow.

As you can see, our new workflow is in Draft status. In Draft status we can modify the process, but this will not run until we activate it.

Activated processes run on the defined event but cannot be edited. To edit a process, it must be in Draft status. You can deactivate your process by clicking on the Deactivate button.

Entity and Category cannot be modified after the process is created. If you wish to change the entity or the category you must create a new process.

The process can be activated as a process or process template.

If you choose the Process template option, it will create a template from this process that will be available on the first dialog when you create a new process under New process from an existing template (select from list). Please note that processes that are activated as Process templates will not be applied, e.g. they will never run.

A process can be available to run as:

  • Run this Workflow in the background (recommended): This check box reflects the option you selected when you created the workflow. This option is disabled, but you can change it from the Actions menu by choosing either Convert to a real-time workflow or Convert to a background workflow.

  • As an on-demand process: Choose this option if you want to allow users to run this workflow manually. You can find on-demand processes under the Run Workflow section of the flow.

  • As a child process: Choose this option if you want to allow the workflow to be available to be started from another workflow.

As a next step the user can set the options for the workflow:

You can set the scope, when the process needs to be started (when the record is created, status changes, etc) and which user should be the owner of the process when it runs.

Once all general settings have been set, we need to define what the process needs to do. We can define multiple steps that can create a new record in Dynamics 365, or update a record in Dynamics 365, or start another process. All these different steps can be run as a result of check conditions that are defined by the user.

We are planning to set the Date delivered and Due date on the invoice when it’s created. To achieve this, we select the Update Record option from the Add Step list. The next step is to select which record we would like to update:

The Date Delivered and the Due Date are on the invoice entity, so we just select the Invoice (under Primary Entity). We can also write a short description for the step that we have just created. Now we are ready to click on the Set Properties button to set the dates.

The system opens an editor to show the field of the invoice entity. We can use the Form Assistant on the right side of the window to set the values for the selected fields.

Let’s click on the Date Delivered field. We would like to set the date when we create the invoice. To set this on the Form Assistant under Operator select the Set tooption. Under Look for section, change the record type to Process and select the Execution time option.

Click on Add button and finally on OK. 

This will change the Date Delivered field as:

Now before we apply this change, let’s set the Due Date to be automatically 30 days after the invoice is created (Date Delivered).

Click on the Due Date field and set the following on the Form Assistant:

  • Operator: Set to
  • Days: 30
  • Option: After
  • Look for: Process, Execution Time

Now click on Add and then click on OK to see your settings in the Due Date field:

Finally click on Save and Close button and save your changes on the Invoice properties.

Now as the last Step, activate your process (‘Activate’ button) and create an invoice to test your new workflow.

I have just filled up all required business information, but as you can see the Date Delivered and Due Date fields are empty. I now click on the Save button to check whether the workflow will set these dates automatically.

Invoice Workflow Microsoft Dynamics 365

And after Dynamics 365 saved my invoice the results are in the 2 date fields. 

This is just one example of the many ways that you can use the processes in Microsoft Dynamics 365.

Good luck and happy processing!