There are many processes in an organization that are handled manually, for example:
Force.com provides us with a beautiful workflow management system to automate these manual problems. The solution for the problems such as the preceding one is given as a part of logic as a service. A typical flow of a workflow is as follows:
The workflow helps in automating the business process that usually requires manual intervention.
The library management wants to send an e-mail to the member who issues the media resource mentioning the details of the media item and the date of return with it. Create a workflow rule to send it to the member.
The following steps will illustrate how to create a workflow:
Evaluation Criteria: The evaluation criteia for a workflow can be any of the following:
For the purpose of the example, the evaluation criteria will be when a record is created or when a record is edited and did not previously meet the rule criteria.
Rule Criteria: As already mentioned in the previous section, rules can be evaluated against values or against formulas. The rule selection criteria are the same as we have seen before. For example, the rule criteria would be if the return date is not null as shown in the following screenshot:
Workflow Actions: We can add different actions to the workflow to perform once the workflow rule criteria and the entry criteria are evaluated.We can add the following actions to the workflow:
We can also reuse the workflow actions in the multiple workflows. To reuse an existing action, like, for example, sending a common e-mail for multiple workflows, select the fifth option of choosing Select Existing Action.
Generally, the workflow action is executed immediately, the moment the workflow is fired. However, in some cases we need to set an action after some amount of time. The general flow of the process is as shown in the next diagram:
For example, to send a reminder e-mail for due date of a checked out resource to the customer. In these cases we use the time-dependent workflows. The time dependent workflow waits for X number of days/hours/minutes after the workflow is fired. The time duration can be relative to the time of workflow or any date field on the record. For example, five hours after the workflow rule is evaluated or two days after the created date.
The time-dependent workflow cannot be used if the Evaluation Criteria is set to Every time a record is created or updated.
If the record has an action pending in the queue and the workflow is modified, this time without meeting the criteria, the pending action is cancelled.
If the record has an action pending in the queue and the workflow is updated again and the timing is changed, the pending action is modified with changes.
The library management wants a clear indicator when the member fails to return the book on the due date. Create a workflow rule to blacklist the member 48 hours after the due date.
To create a time-based workflow, perform steps one to three of creating a workflow and then continue with the following steps:
In the general library, they wish to send a reminder e-mail to the user about returning the book on time. The user has to return the media item 14 days after the check-in date. Create a time-based workflow that will send a reminder e-mail five days BEFORE the due date.
The library also wishes to send the reminder e-mail two days after the due date. However, if the user checks-in the book before the reminder it should automatically stop the alert. Create a time-based workflow for the same.
We have already seen how to create a time-based workflow; this exercise is to practice for the same. Use the example given in the section as a reference and create these time-based workflows.