1. Define triggers:
Define the workflow as On-Demand and Child workflow (not automatic triggers)
2. Define process:
Define the body of the workflow to represent the set of actions that must occur every month:
3. Add the Wait:
Now you need a way to tell the workflow engine to repeat the process every month. To do so, I will first insert a wait step that will tell the workflow engine to wait for 1 month:
After the step, I need a way to “restart” the workflow. Since there are no while/for loops in the workflow designer, we must find another solution. I will simply create a recurrence pattern by having an “Execute child workflow” step which executes itself. Because the workflow is defined as a child workflow, it will call itself every month. After I activate the workflow it looks like this:
4. Trigger the workflow once
The first time that the workflow executes, it must be triggered manually, after that it will schedule itself monthly from the time that it was executed manually. Since it is defined as an on-demand workflow, you can simply navigate to your primary entity and trigger the workflow manually.
5. Verify
Once your workflow has been triggered for the first time, it should appear in the system jobs grid, waiting for the next month to resume execution:
Note that “month” is not the same as 30 days, it actually uses the calendar month definition, since CRM workflow uses the .NET DateTime class. Therefore, if it was first triggered the 1st of the month, it will always trigger the 1st of the month regardless of the number of days in a month.





No comments:
Post a Comment