Sunday, April 17, 2016

Scheduled Workflows in CRM

Workflows are a valuable tool within Microsoft Dynamics CRM. So what if you want to schedule workflows at a certain time, or execute a workflow every night, week, or month? This blog will show you how to create a recursive workflow to be executed for a certain time, and how to create scheduled workflows in CRM.
In this example, we will create workflows to be executed every night, which will check if the account’s primary contact is empty. If it is empty, the workflow will find its primary contact and populate the primary contact field.
  1. Create the 1st new workflow with Contact as the primary Entity.
    Set this workflow as “Child Process” and as “on-demand” as well:
    scheduled workflows in CRM
  2. Add a wait condition to start every day or every 24 hours.
  3. Add check conditions and actions. One of the actions is called a child workflow, the identical second workflow, right before stop itself.
    When complete, it will look like the sample below:
  4. Create the second workflow similarly.
  5. The workflow will need to be to be triggered manually the first time.
Once you have triggered one of the workflows, it will automatically execute and trigger the other workflow right before it stops. Therefore, only one of the workflows will be in  process and handle the same job recursively.
If you want the workflow to start at 3:00 a.m. and you don’t want to stay up in the middle of the night to manually trigger it, you can create a third workflow, which will have a similar timeout condition set as step 2. The third workflow will trigger the first workflow instead of having to be manually triggered by you.
Similarly, if you just want to create a scheduled workflow instead of a recursive workflow, you can simply create the first workflow with a timeout condition set as step 2; then, wait for certain time to trigger the second workflow.
In summary, you can set up two identical-child-type workflows to handle recursive jobs; add an additional timeout workflow to handle any scheduled jobs.
If this was helpful, 

No comments:

Post a Comment

Get files of last hour in Azure Data Factory

  Case I have a Data Factory pipeline that should run each hour and collect all new files added to the data lake since the last run. What is...