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.
- Create the 1st new workflow with Contact as the primary Entity.Set this workflow as “Child Process” and as “on-demand” as well:
- Add a wait condition to start every day or every 24 hours.
- 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:
- Create the second workflow similarly.
- 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