Now that you understand how to trigger workflow and create actions based on it, let's look at implementing logic to control when workflow is executed.
Workflow Manager provides three basic logic constructs you can use in creating workflow rules. You will see these options when you select the When <object> is created line at the top of the rule window, and then select the Insert Condition' link to the left. The options are
Check for conditions
Wait for conditions
Wait for timer
We will describe each of these in detail in the following section.
The “check for conditions” option takes the following format:
If << add conditions here >> : if multiple conditions, they will treated as an 'AND' Then << add actions here >> : if multiple actions, all will execute End If
This is a traditional If Then construct that enables you to take action-based conditions you can check at the time the rule is running. If Then constructs can be nested to multiple levels as shown in Figure 12.20.
When you select the << add conditions here >> line and click the Insert Conditions link to the left, you are presented with the following options:
Check object condition
Check activities
Else If
Check object condition enables you to compare the current values of the objects, and related objects, fields with values you enter in the rule. An example of this is
Case.origincode = Phone
Check activities presents the dialog box shown in Figure 12.21. This checks to see if any Activities were created for the active object. If Activities were created, the configured actions are taken. If not, no actions are taken.
The Check Workflow Activities dialog box offers one option so you can specify whether Activities created as part of the active workflow count in your determination of whether Activities have been created.
Else If inserts an additional logical construct into the If Then statement for when you need more than a single check. Else If constructs must always be inserted inside an existing If Then. Anywhere you have an If Then you can insert additional Else If to perform additional checks.
Let's make sense of the Else If construct with a simple example. Imagine your company provides customer service exclusively through service contracts you sell to your customers. You have three levels, Gold, Silver, and Bronze. Each entitles the customer to different services:
Gold: Case is marked high priority and one-hour response is guaranteed.
Silver: Case is marked normal priority and 24-hour response is guaranteed.
Bronze: No phone support is offered, instead the customer receives an email with a link to the online knowledge base and a number to call if he is interested in a service contract upgrade.
This logic requires an If Then construct with an embedded Else If to accommodate the third condition. The workflow rule is illustrated in Figure 12.22.
Notice that in this example, we're checking the Case's associated Contract record to get the Service Level Code. This check is inserted in the << add conditions here >> section of the construct by clicking the Insert Condition link on the workflow rule configuration screen.
Wait for conditions enables you to take action based on the passage of time or a change in the object's condition. When you select the << add conditions here >> line and click the Insert Conditions link to the left, you are presented with the following options:
Wait for object condition
Wait for activity condition
Wait for object condition is the equivalent of waiting for an update to the record. For example, you can use this option to monitor the Status Reason field to see when it has been changed and take action accordingly. Figure 12.23 illustrates a workflow rule where the Case Contact is emailed when the Status Reason has been changed to Waiting for details.
Wait for activity condition enables you to trigger workflow based on the completion or cancellation of an Activity. Figure 12.24 shows the wait activity condition screen.
For example, suppose you require that each of your Cases be concluded with the CSR (Customer Service Representative) emailing a CSAT (Customer Satisfaction) survey to the client. You could use the Wait activity condition option, illustrated in Figure 12.25, to reassign the Case to the user's manager when this Activity is marked complete.
The Wait for timer option presents the screen pictured in Figure 12.26 to enable you to configure the wait conditions.
The timer configuration screen gives you the following three options when configuring time base workflow:
From now on
After
Before
You can use the After option to specify how long past the created on date/time to wait until action is taken. The From now on option starts the clock ticking as soon as the workflow rule is executed. Effectively, the After and From now on options yield the same result with the Create event. However, you could use the From now on option to create rules that enable you to promise follow-up to your customer by a certain time period.
Figure 12.27 provides an example of the After option to notify a CSR's manager if a Case is past its guaranteed response time.
The Before option monitors a date to proactively take action in advance of the date's arrival. For example, this option can be used with the Contract's cancel on date to provide notification for a Service Contract that is nearing expiration. This workflow could automatically send a template generated email outlining options for contract renewal.