Salesforce Essentials for Administrators
上QQ阅读APP看书,第一时间看更新

Workflows

Often, our application needs the ability to send e-mail alerts, create and assign tasks on creation and modification of records, or update some of the fields depending on user input.

A common life business scenario could be that on the closure of a case (more specifically, when the status of the Case field changes to the value closed), I would like to assign a task to a service rep to inform the customer that their case has been closed and also send an e-mail to the contact (customer) that their case has been resolved.

To achieve all these functionalities, Salesforce has provided us with a toolset named workflows.

To start building a workflow, navigate to Setup | Create | Workflow & Approvals | Workflow Rules, as shown in the following screenshot:

The workflow itself has two main parts; I generally call the first part the header and the other part, the action. The header consists of three mandatory parts: rule name, evaluation criteria, and rule criteria. The action will involve four types: primarily field updates, e-mail alerts, tasks, and outbound messages. These actions can be immediate or time dependent. Time dependent means we have the option to execute the workflow action after a certain interval of time (it is configurable ranging from minimum number of hours to maximum number of years).

Let's explore all the information we have collected with the help of a simple example.

The problem statement is that we are going to create a workflow to solve our business problem of sending an e-mail to the contacts on the closure of a case and also create a task against the owner of the case.

Create the header first. As discussed, the header will involve three important aspects:

  • Object selection and name
  • Evaluation criteria
  • Entry criteria

For the evaluation criteria, one has to make a choice between three different types with the help of a radio button. The types are as follows:

  • created
  • created, and every time it's edited (a time dependent action is not possible using this type)
  • created, and any time it's edited to subsequently meet criteria

The third option implies that the workflow will not always fire. It will fire only if there is a change made that affects the rule criteria.

Let's consider the last option for our example.

Rule Criteria is a simple formula-based expression or logical expression that is necessary to be satisfied for the action to be triggered.

In our scenario, the Rule Criteria is that the Status field of Case should be Closed. This is shown in the following screenshot:

After entering data for the header, let's associate some actions to the workflow rule. The actions for our problem will be e-mail alerts and task creation.

Our task will be to create an e-mail alert and an action for the creation of a new task. For a new task, you will need to fill in a form, which looks similar to the following screenshot:

The Assigned To field will be the case owner selected from the lookup icon. Our next section will deal with e-mail alerts.

For a time-dependent workflow, we will need to add a time trigger as well as defining the workflow action.

To see the entire configuration in action, you will need to go to the Cases tab, edit a case, and bring it to the Closed status. Then, you will receive an e-mail alert and an activity will be assigned as per the form details for the new task we created in the previous step.

Another very important concept to understand is how to monitor time-dependent workflows in Salesforce. Navigate to Setup | Administration Setup | Monitoring | Time-Based Workflow to access the Time-Based Workflow window. This is shown in the following screenshot:

Here, on selecting certain parameters from the dropdown, you will be able to search for a time-based workflow and see its status. If you do not enter any search criteria, it will display all the scheduled actions on the same page.

It's again important to understand that if the rule parameter variables change (that is, Field values) in the time period for which the workflow action is in a time-dependent queue, the time-dependent action readjusts itself.