Recently, we encountered a scenario where-in we need to send recursive mails for every xx hours, when the deadline is reached, until the task is completed. I am presenting the same here, with a simple example, hoping that this would be useful to you all.
Start a new workflow and define a "User Decision" step. For steps on how to define a User Decision step, click here.
In the step "User Decision", switch to tab "Latest End" and provide the details as shown below:
In the action, select "Modeled" from the list. Enter the name of the outcome.
Click on "Transfer and to Graphic" (Green tick button).
You can notice that there are 3 branches now. Two belong to the User Decision Step (YES/NO) and the other one is of Modeled deadline. So whenever a deadline is reached, this branch executes. When the user completes his task, it would either take YES or NO branch accordingly.
Now assume that we need to send repetitive mails to the agent for every 3 minutes, until he completes the task (in this case, acting on User Decision step).
Double-click on "Undefined step" in the "Modeled" branch and select LOOP(Until)
Using "Loop (Until)", we would be sending emails repetitively for every 3 minutes. To keep the loop open continuously, lets define a condition which would never be met.
Enter a step name and then click on "Click here to create a new condition".
Since we intend to make this Loop indefinite, create a condition similar to the following one.
Now go back to the main screen.
The above screenshot is of the step "Loop (Until)". Now double-click on the "Undefined" step above and create an email step.
Enter the recipient name and other details as shown above.
Now we need to send mails once every three mails until the task is finished. To achieve this, we would need to create a business object (or use an existing one) and create a dummy method (with no code in it). Ensure that the check box "dialog" is unchecked in the properties of this method.
Now create a step "Activity" by double-clicking on undefined step after the email step in the Modeled branch.
Click on "Create new task"
Provide the details as shown below:
Don't forget to check the checkbox "Background processing".
SAVE and click on Back button.
In the activity step, switch to "Requested start" tab and provide details as shown below:
Using the above step, we are restricting the LOOP to send mails for every 3 minutes only.
Save and activate your workflow.
Test run the workflow. Do NOT execute the work item and wait for the alert mails.
Work item in inbox:
Work item along with the alert mails (after the deadline is reached):
No comments:
Post a Comment