Once activated, workflows automate and thus, facilitate business processes in Microsoft Dynamics 365 (CRM).
In this step-by-step tutorial, you will learn how to create workflows with DocumentsCorePack Server Based successfully.
Requirements: DocumentsCorePack ServerBased, Microsoft Dynamics CRM 2015/2016 or Microsoft Dynamics 365 (CRM)
Prerequisites: Create a new workflow
Please access your Microsoft Dynamics 365 (CRM) and navigate to Settings > Processes. In the My Processes – area, click on the [New]-button in order to create a new workflow.
A webpage dialog pops up. Type in a name, determine an entity and select “Workflow” as the process category. Afterward, click on the [OK]-button.
Within this tutorial, we will create the following steps:
1) Create a document
2) Insert a Wait Condition (Has the document creation been finished yet?)
3) Attach document to letter – Step A
4) Attach document to letter (if finished – Step B)
5) Insert a Wait Condition (Has the document creation been finished yet?)
6) Delete document
We will work with the entity Contact, the category Workflow and the process CRMWorkflowExample. Our starting point is the Process: CRMWorkflowExample-dialog.
Step 1: Create a document
This option supports you when dealing with the creation of documents. To create a new record (e.g. document), simply click on the [Add Step]-drop-down menu ❶ and select Create Record ❷
The dialog below opens. It allows you to configure the first step of your workflow. Again, name the window (here:Create Document ❶) and look for CreateDocument in the AutoMergeAction field ❷.
Now, click on the magnifying glass next to the TemplateToExecute field and select the template that should be used within the workflow ❶ and the file format the document should be saved as ❷.
It is also very important to insert the PrimaryRecordUrl. To do so, set the cursor in the PrimaryRecordUrl-field ❶ and select Record URL (Dynamics) in the drop-down menu in the Form Assistant ❷, click on the [Add]-button and on the [OK]-button. The PrimaryRecordUrl-field is filled now. Do not forget to save your changes!
The first step of your workflow is now added and fully configured. If you want to stop your workflow at this point, you can click on the [Save and Close]-button and finish here. If you want to add further steps, you have to define a condition to be fulfilled before adding further steps.
Step 2: Wait condition
Whenever you add a step, you need to make sure that the step has been finished before you start with the next step. The Wait condition step checks this automatically.
For example, if you want to create a letter-activity with the previously generated document as an attachment, you need to make sure that the document creation is completed, before you attach the document to the letter activity. To do so, open the [Add-Step]-drop-down menu and select the Wait Condition.
When the step has been added to your workflow, you may want to give it a name that reminds you of what it contains, e.g. Wait condition ❶. Then click on (click to configure).
The next window allows you to define the condition to be fulfilled for the workflow proceeding.
Whenever you click on Select, a drop-down menu opens that allows you to set the conditions for this step. For our purpose, we select the conditions Create document (MSCRM-ADDONS.com AutoMergeWorkingItems)❶, Status ❷, Equals ❸ and Inactive ❹ from the Select Values dialog.
If you have followed the steps carefully, your window will look like this one. Click on the [Save and close]-button.
By setting this step, you have determined that step 2 of this workflow will only be executed if step 1, the document generation, has been finished successfully.
Step 3: Attach document to letter – Step A
The next step enables you to attach a document to an already existing letter.
To add the next step, e.g. to create a letter-activity, simply click on Select this row and click Add Step ❶ and afterward, click on the [Add Step]-button ❷ and select Create Record from the drop-down menu.
When the step has been added to your workflow, you may want to give it a name that reminds you of what it contains, e.g. Attach document to letter ❶. Then open the drop-down menu next to Create, select Letter ❷ and click on the [Set Properties]-button ❸.
Within the next window, you must define a sender and a subject and type in the letter’s text.
To define the recipient, click in the Recipient-field ❶ and go to the Look for-area within the form assistant on the right side. Select Contact in both drop-down-menus, ❷ click on the [Add]-button ❸ and then on the [OK]-button ❹ . Once finished, do not forget to save your settings.
Step 4: Attach document to letter – Step B
This step makes sure that the previously created document will be added to the letter-activity. To attach a document to the letter, simply click on the [Add Step]-drop-down menu ❶ and select Create Record ❷.
When the step has been added to your workflow, you may want to give it a name that reminds you of what it contains, e.g. Attach document to letter – Step B ❶. Then open the drop-down menu next to Create, select MSCRM-ADDONS.com AutoMergeWorkingItems ❷ and click on the [Set Properties]-button ❸.
The dialog that opens now allows you to configure the AttachToLetter-workflow-step. Name it and define the corresponding AutoMergeAction (here: AttachTo letter). ❶
Within the Attach to Letter-section, you can determine the letter-activity to which the created document will be attached to and the document which should be attached. ❷
To determine the letter-activity, which the document should be attached to, set the cursor in the LetterToAttach-field in the AttachToLetter-section ❶ and select CreateDocument (MSCRM-Addons.com AutoMergeWorkflow) from the first drop-down menu in the Look For-section and LetterToAttach from the second within the form assistant on the right side. ❷. Once finished, click on the [Add] -button ❸ and then on the [OK]-button ❹.
To determine the document which should be attached, set the cursor in the DocumentGUID_Letter-field ❶ and select the correct document from the drop-down box in the Look For-section within the form assistant on the right side. ❷ Then click on the [Add]-button ❸ and on the [OK]-button ❹.
You have now completed the configuration of this step. Do not forget to save the settings!
However, if you want to stop your workflow at this point, simply click on the [Save and Close]-button within the general workflow-configuration-window and finish here.
Step 5: Insert another Wait Condition
If you want to add further steps to your workflow, you have to define another Wait-Condition to be fulfilled before you add further workflow-steps. For more information in Wait Conditions, have a look at Step 2.
Step 6: Delete document
However, as soon as the condition is set, you can add another step. In our example, we want the document to be deleted after it has been attached to the letter-activity.
To create this step, click on Select this row and click Add Step and open the [Add Step]-drop-down menu. Select Create Record and type in a description. Select MSCRM-ADDONS.com AutoMergeWorkingItems from the drop-down box within the step and click on Set Properties.
A dialog pops up in which you can set that the document will be deleted. To do so, name the process and the action (we decided to call the process ‘DeleteTempDocument’). Afterwards, click in the DocumentGUID_Delete-field within the Delete Temp Document-section ❶ and select the document to be deleted from the drop-down box in the Look For-section within the form assistant ❷. Click on the [Add]-button and then on the [OK]-button. Do not forget to save your settings!
Theoretically, you could add as many steps as you wanted to add to a certain workflow. But as our last step consists of deleting the document, we decided that it is the last one for our workflow.
STEP 7: Get your result
If you have followed all the steps, your result should look similar to the below screenshot.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to email@example.com!