Dynamic Values in Workflow


Now that you understand the concepts involved with using, creating, and managing workflow, let's get into some of the details related to actually creating rules and actions. One of the most important workflow features that you'll use (probably in every single rule that you create) is dynamic values. Conceptually, dynamic values in workflow are almost identical to the data fields concepts that you learned in regard to E-mail templates. You can use dynamic values in your workflow rules to populate information specific to the workflow entity into your conditions, actions, assemblies, and so on. As a matter of fact, you'll even use data fields in conjunction with dynamic values within a workflow rule.

To help illustrate the benefits of dynamic values, let's consider a common business scenario. For every new case created, your company wants the following processes to happen automatically:

  • Send an e-mail message to the customer acknowledging that you received the request; include the case number in the message so that the customer can reference it later.

  • Send a notification e-mail message to the case owner about the new case, including data about the customer.

Because we want this process to run for every new case created, we'll obviously create a workflow rule for the Case entity and select the Create workflow event. Next, we'll insert a send e-mail action to send the case acknowledgement message to the customer. Fortunately, Microsoft CRM includes an E-mail template called New Case Acknowledgement that we'll use for this rule, shown in Figure 8-22.

image from book
Figure 8-22: Using the New Case Acknowledgement E-mail template

You'll notice that when you select an E-mail template, Microsoft CRM disables all of the fields except for the Cc and Bcc fields. That's because all of the data for these disabled fields is defined by the E-mail template. If you examined the E-mail template, you would see that it contains the information shown in Figure 8-23.

image from book
Figure 8-23: New Case Acknowledgement E-mail template

This E-mail template already includes the case number as a data field ({!Case:Case Number;No Reference Code}), so we can use the template with no modifications. Since this send e-mail action does not require any further modification, all we need to do is click Create E-mail. We could have added the case owner as a Bcc recipient, and he or she would receive a copy of the message. However, we want the message to the case owner to include additional information about the case and the customer that this E-mail template doesn't include. So for our next step, we'll insert another send e-mail action in the workflow rule.

Tip 

You can't specify the recipient in the To line when you use an E-mail template in workflow. Microsoft CRM sends the e-mail message to the customer related to the record. So, if you need to be able to set the recipient in the To field, you cannot use an E-mail template.

For the internal message to our customer service representative (the Case owner), we'll set the To recipient as the owner of the case. In the Subject line, we want to include the case number and the customer name. To get those two values to appear in the message, we'll insert a data field that references a dynamic value. For our e-mail Subject line, we entered the following text: Case # for customer was assigned to you.

Now we'll insert the data fields where we want them to appear, starting with the case number. Place the cursor to the right of the # symbol, and then click the button that appears to the right of the Subject field. The data field dialog box shown in Figure 8-24 appears.

image from book
Figure 8-24: Data Field Values dialog box

This dialog box is almost identical to the data field dialog box for E-mail templates (see Chapter 2, "Setting Up Your System," for details). When we click the New button, the Select Value dialog box appears, as shown in Figure 8-25.

image from book
Figure 8-25: Select Value dialog box

In the Select Value dialog box, you can insert a static or dynamic value in the data field:

  • Static value Inserts a fixed value in the data field. This static value will appear on every single record that references the rule.

  • Dynamic value Inserts a data value that varies depending on the current record running the workflow rule.

In this example, we obviously don't want to insert a static value for the case number, because each case includes a unique number. Therefore, we'll insert a dynamic value of Case Number in our data field.

Important 

Using dynamic values in workflow rules allows you to insert data specific to the entity running the workflow rule. In addition, you can insert dynamic values from entities related to the workflow entity.

If you click the Entity picklist, you'll see that we can insert dynamic values from the Case entity in addition to entities related to the case, such as Case, Owner, Account, Contact, Contract, and Subject. Because we want the case number, we'll select the Case entity and then click Case Number in the Field picklist. When we click OK, Microsoft CRM returns us to the data field editor. We click Insert Field and then click OK, acknowledging that we didn't set a default value (because every case includes a case number by default). You should try to always include a default value when you insert data fields.

In the Send E-mail dialog box, you'll notice that Microsoft CRM inserted the data field {!Case:Case Number;} in our Subject line. When Microsoft CRM executes this rule, it will retrieve the case number and automatically drop that dynamic value into our Subject line! Now we'll repeat that process to add more dynamic values that we want to include in our message. Figure 8-26 shows our e-mail message, complete with dynamic values from multiple entities such as Case, Account, Contract, and Subject.

image from book
Figure 8-26: New case e-mail message with multiple dynamic value data fields

Important 

You can use data fields with dynamic values with almost all of the workflow actions, such as create activity, send e-mail, create note, update entity, and so on. You can also reference dynamic values within conditions to evaluate expressions in workflow.

Now that our e-mail message is complete, we've satisfied the two requirements that our business process wanted for new case creation. At this point, you should save your new workflow rule, and don't forget to activate it. As you can imagine, dynamic values provide you with a lot of flexibility in designing and creating your workflow rules. They also benefit your users and customers, because you can include very specific and individualized data in the actions that your workflow rules execute.




Working with Microsoft Dynamics CRM 3.0
Working with Microsoft Dynamics(TM) CRM 3.0
ISBN: 0735622590
EAN: 2147483647
Year: 2006
Pages: 120

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net