Crm30 Enus Cus 04

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Crm30 Enus Cus 04 as PDF for free.

More details

  • Words: 19,608
  • Pages: 88
Chapter 4: Workflow

CHAPTER 4: WORKFLOW Objectives Actively participating in this Chapter helps you: •

Import and export Workflows



Create Workflows



Define Workflows



Define Workflow Conditions



Define Workflow Actions



Configure Sales Processes



Manage and Monitor Workflows



Troubleshoot Workflow problems

Overview Workflow Customizations Workflow is probably the single most powerful type of customization in Microsoft CRM. Workflow allows for creating automated business processes. This guarantees that customers receive a consistent experience with the organization.

Focus of this Chapter This chapter introduces you to all the Workflow features and gives you the hands-on experience necessary to understand what you can expect. This chapter systematically covers each of the Workflow events, actions and conditions, providing you with opportunities to work with each. You are also introduced to how all the Microsoft CRM objects interact with each other in order to achieve the processes desired by the organization.

Page

151

Microsoft CRM 3.0 Customization

Scenario Adventure Works Cycle has used Workflow to achieve goals in their CRM Strategy. Two examples are presented here. •

Customer Service: A specific example



Sales: A higher level example

Customer Service Adventure Works Cycle uses Service Contracts to track whether customers are entitled to support. When a Customer Service representative creates a case, they are trained to associate each case with a Contract and Contract Line. Adventure Works Cycle also has Service Level Agreements (SLA) in their contracts. If a Case is not resolved within defined periods of time, it will be escalated and the customer will received e-mail communication on the status of their case.

Requirement Level The Contract and Contract Line fields are set to a Requirement level of Business Recommended instead of Business Required. If the fields were set to Business Required the customer service representative would not be able to save the case without a contract. As soon as a Case has been associated with a Contract, the Contract Line field becomes a required field.

On Hold Status To provide a better experience for their customers, Adventure Works Cycle wants their customer service representatives to create and save cases even when a contract does not exist. The case will be set to a status of "on hold" until a contract can be established to associate with the incident.

Workflow Workflow helps the Customer Service Representative remember to follow through and associate the case with a contract. If the Case is saved without a contract, workflow will detect this and a task is created to serve as a reminder for the Customer Service Representative to work with the Contract.

Client-Side Code The processes enforced by Workflow are also supported with client-side code. If a customer service representative tries to save a case without a contract, clientside code on the save event will display reminder to associate the case with a contract. The Onload event is used to display a message to remind them of cases that are not associated with a contract. NOTE: How To Use Client-side Code is introduced in Chapter 5: Application Event Programming.

Page

152

Chapter 4: Workflow Sales Workflow can be used in many ways related to sales. Some of them include the following: •

Training



Routing



Coordinating



Sales Process

Training When a new salesperson joins the organization, they may need some guidance about the correct procedures to follow. Workflows can be defined to create Tasks that will help guide the new salesperson to complete the required procedures. After a period of time, these workflows will no longer be applied to the sales person’s opportunities. Routing Opportunities can be assigned to sales people based on criteria like: •

Number of open opportunities



Territory



Product



Potential Revenue

Coordinating A salesperson may rely on the help of other resources, such as an office administrator or technical support staff. Workflow can create and assign activities that will support the salesperson. Sales Process Adventure Works Cycle may choose to define a specific sales process that will define specific stages in the opportunity and create tasks that must be completed before the opportunity can move to the next stage. Each stage is associated with a probability that is used to forecast the potential revenue. This information can be used to determine whether resources might be better applied to other opportunities.

Page

153

Microsoft CRM 3.0 Customization

Core Concepts Business Process Automation Microsoft CRM Workflow is a powerful tool that can help business managers define, automate, and enforce specific business rules, policies, and procedures. Workflow simplifies and streamlines current business processes. Workflow can be used to make businesses efficient in their day-to-day operations.

Actions and Conditions Workflow enables actions to occur without direct interaction by the users, based on rules set up by the business. Workflow rules are triggered by events within Microsoft CRM when specific actions are performed and specified conditions are met.

Types of Workflow There are two types of Workflow: •

Workflow Rules



Sales Processes

Workflow Rules Workflow rules apply to most commonly used entities including custom entities.

Sales Processes Sales Processes are an advanced form of Workflow. They apply only to Opportunities. This chapter introduces Workflow Rules before introducing the additional functionality included in Sales Processes. Sales Processes will be introduced on page 215.

Workflow Tools Microsoft CRM includes four tools to design and manage workflow processes. These are described in Figure 1.

FIGURE 1 - WORKFLOW TOOLS NOTE: You must be a member of the System Administrators Role to run these tools.. These tools can only be run on the CRM Server, although you may use a Terminal Services client to operate them remotely.

Page

154

Chapter 4: Workflow

Defining Workflow Rules A workflow rule consists of defined actions and conditions.

Procedures Defining a Workflow Rule consists of the following procedures: •

Create a Workflow Rule



Specify Workflow Actions



Specify Workflow Conditions



Activate the workflow

Accessing Workflow Manager 1. Open START→ PROGRAMS → MICROSOFT CRM → WORKFLOW MANAGER. 2. In the Workflow Manager Logon, enter the name of the Microsoft CRM server to run the workflow manager.

Procedure: Create a Workflow Rule 1. As soon as the Workflow Manager Window opens, the entities that support workflow will display in the drop-down window. Confirm that "Rule" is selected from the View control. 2. Select the entity and then File→ New to create a rule 3. The rule form wizard opens. Enter information about the following. •

Rule name



Description



Select the Event

NOTE: The rule name and description can be modified at any time, but the event cannot be changed.

4. Click Next. 5. Click Save to create the workflow or continue to define Workflow actions and conditions. The workflow will not do anything until you specify actions

Page

155

Microsoft CRM 3.0 Customization Procedure: Specify Workflow Actions As soon as you have created a workflow, you must define what it does. 1. From the Common Tasks area, click Insert Action. 2. Select from the list of available actions. 3. Configure the action based on the type of action.

Procedure: Specify Workflow Conditions You might want to specify conditions to determine which actions are taken. 1. From the Common Tasks Area, click Insert Condition. 2. Select one of the three type of conditions. 3. Configure the condition based on the type of condition.

Procedure: Activate the Workflow After you have saved the workflow, it is in an inactive status. Before it can be used, it must be activated. 1. From the Workflow Manager list, select the rule from the list. 2. Then, select ACTIONS→ACTIVATE.

Creating a Workflow Rule The first step in defining a workflow rule is creating the workflow. As soon as the workflow is created, you can define it by adding actions and conditions.

Entities That Support Workflow Rules User owned entities that represent an interaction with a customer generally support workflow. These are listed in Table 1. Custom user-owned entities also support workflow. NOTE: The entity instance that is associated with a particular workflow rule is called the bound object.

Page

156

Chapter 4: Workflow

Account

Appointment

Campaign

Campaign Activity

Campaign Response

Case

Contact

Contract

E-mail

Fax

Invoice

Lead

Letter

List

Opportunity

Order

Phone Call

Quote

Service Activity

Task

TABLE 1 ENTITIES THAT SUPPORT WORKFLOW

Activity Entities that do not support workflow rules Table 2 lists activity entities which do not support workflow. These activities are generated by Microsoft CRM and are not user-owned. Opportunity Close

Quote Close

Order Close

Case resolution

TABLE 2 ACTIVITY ENTITIES THAT DO NOT SUPPORT WORKFLOW

Rule Name The name that you select for the rule should be descriptive and unique. We recommend that you establish a standard naming convention that helps you quickly identify the function for the rule. Manual Workflows should have a name that lets users differentiate it from other types of workflow when they choose it from within the application.

Rule Description Rule Description provides a area for a detailed description of the rule. Although the Description field accepts a long string of characters, only the first 50-100 characters are visible in the User Interface.

Page

157

Microsoft CRM 3.0 Customization Workflow Events Workflows are triggered by events. Table 3 lists the available Workflow events. The event that triggers workflow is defined when the workflow is created and cannot be changed. Event

Occurs

Create

When an object is created

Manual

Generally intended to be used when the users select "Apply Rule" from the Actions menu within the application.

Assign

When the ownership of an object is transferred to a different user.

Change Status

When the current status (or "state") of an object changes. An example would be changing the status of an Account from Active to Inactive.

TABLE 3 - WORKFLOW EVENTS NOTE: All rules, regardless of event, are available from the Apply Rule dialog. Manual Rules are rules that are not explicitly associated with an event. Workflows using the manual event can also be used as a sub process action. Only manual rules can be used in a subprocess. See "Run Subprocess" on p.174 for more information.

Copy Workflow rule From Workflow Manager, it is possible to copy an existing Workflow rule. This can save considerable manual entry when creating a number of similar rules.

Procedure: Copy Workflow Rule 1. In the list, select the workflow rule you want to copy. 2. On the Actions menu click Create Copy. An exact copy of the existing rule is created except that the rule name is prefixed with ">>".The rule can be modified, including renaming the rule to remove the ">>" characters if desired. The newly created workflow will not be activated. Workflow templates are another feature that can reduce repetitive manual entry of workflows. See Use Templates on page 225.

Set Workflow Order When you have multiple workflows that execute for the same event on the same object, you can control the order in which they are called using the Set Order control.

Page

158

Chapter 4: Workflow Procedure: Set Workflow Order The workflow simply sets the order in which the workflows are initiated. Each workflow waits for the earlier ones to complete or reach a status of waiting before they are started. If you set a Wait For condition in a workflow, any workflows that follow it begin without waiting for the Wait condition to complete. See Wait For Condition on page 197 for more information.

Demonstration: View existing Workflow The Microsoft CRM Sample data includes some sample workflows. This demonstration will use these sample workflows to illustrate some Core Concepts of workflow.

Scenario Microsoft CRM Sample data has been installed on a test server. Observing some of the sample workflows shows how workflows can provide business process automation.

Goals Observe how Workflow rules are structured.

Steps Step 1: Review Opportunity Status Changes Rule 1. Open Workflow Manager. 2. Note the different entities that support workflow and select Object Type = "Opportunity". 3. Select the View and note that there are four options: – – – –

Rule Rule Template Sales Process Sale Process Template

NOTE: Opportunity is the only Entity that has Sales Processes

Page

159

Microsoft CRM 3.0 Customization 3. Choose Rule and observe that the Opportunity Status Changes Rule is visible. The properties of the rule are displayed in Table 4. Name

Opportunity Status Changes Rule

Description

Rule to send email to manager when status changes on certain opportunities

Event

Change Status

Status

Inactive

Owner

Administrator

Business Unit

Adventure Works Cycle

TABLE 4 – OPPORTUNITY STATUS CHANGES RULE PROPERTIES

5. Double click the rule to open it. 6. Note the logic in the Workflow. A

When opportunity status is changed

B

if

C

Opportunity.Status = Lost then

D

E-Mail To: Sales Manager; Subject:{!Account:Account Name;Opportuni..} Lost. end if A. Event: This rule is based on the Change Status event on the opportunity B. Check Condition: Creates the "if...then...end if" structure of the rule C. Check Object Condition: Tests whether the status of the opportunity equals "Lost". D. Action: If the Check Object Condition is true, the send mail action will send an email to the Sales Manager

7. Close the Opportunity Status Changes Rule by clicking Cancel.

Page

160

Chapter 4: Workflow Step 2: Review Lead Workflows 1. In Workflow Manager select Lead as the Object Type. 2. Note that there are three rules. Two of the rules are on the Create event. 3. Select either of the Create Event rules. Note that you can set the order in which they will be applied by clicking the "move up" and "move down" arrows. 4. Select all three rules and select "Activate" NOTE for Beta Course: The Marketing Sub Process will not activate. This is a bug with the TAP2 release.

6. Open Microsoft CRM and open an Active Lead. 7. Select ACTIONS → APPLY RULE.. 8. Note that the Activated Workflow rules appear regardless of Event.

Workflow Limitations Two Limitations of Workflow are: •

Latency



No Update Event

Latency The Microsoft CRM Workflow Service does not respond immediately to events. Give the workflow service about 30 seconds to respond. NOTE: When testing workflow rules where the results are visible on the form, be sure to close and re-open the Object form. Workflow is applied at the Microsoft CRM Platform, so the results are not immediately visible in the client.

Page

161

Microsoft CRM 3.0 Customization No Update Event Workflow Manager does not include Update as an event that can trigger workflow. However, the update event exists and Workflow listens for it. There are three approaches you can use to create a workflow that uses the update event: •

Use the Check Object Condition



Create a looping workflow to capture changes.



Use the SDK Post-callout

Check Object condition To check whether a particular field meets a condition on an update, define a workflow with a check object condition. This detects when a particular object attributes meets a specified condition. The workflow executes at that point. It only executes once. NOTE: For more information on the Check object condition see Defining Workflow Conditions on p.196.

Looping workflow It is possible to create a looping condition with workflow to detect when an object has been updated. Table 5 describes an example workflow on the Account entity called "Update Loop".

B

Manual Rule Add DateTime: Execution Time

C

wait

A

Account.Modified On > Execution Time end wait D E

Exec: Update Loop

TABLE 5 - UPDATE LOOP WORKFLOW RULE

A. Event: A looping workflow has to be a manual process so that it can call itself as a subprocess B. Execution Time: The Call Assembly Add Date Time method is used to capture the Execution time. See Call Assembly on page 175 for more information. C. Wait Object condition: The workflow listens for the update event which is established by confirming that the Account.ModifiedOn time is greater than the Execution Time. See Wait Object on page 197.

Page

162

Chapter 4: Workflow D. Business Logic: When the wait condition ends, the Object has been updated. You can include any actions you wish to perform here. E. Exec: Update Loop: The final step is for the workflow call a new instance of the Update Loop workflow as a subprocess. This allows the current instance to end and a new execution time will be set in the new instance. NOTE: Workflow checks for changes at a set interval. The example provided here will not detect every one of rapid number of changes in a short period of time. But it will detect the last change made. This can be an advantage in the event a user accidentally saves a record with the wrong value. If the user immediately changes to the correct value, the looping workflow will not respond to the value that was set accidentally.

SDK Callout The Microsoft CRM SDK supports a callout model which allows code written by a developer to listen for the update event. The developer can perform any action using the methods in the SDK.

Defining Workflow Actions Table 6 describes the actions which can be performed in a workflow. For the purpose of this lesson, we discuss them in the context of groups describing the type of actions. Group

Action

Activity Creation

Create Activity Send e-mail Create Note

Object Update

Emails may be sent to email addresses related to the object An e-mail activity will record the message The message may use an e-mail template Attaches a new note to an object

Assign Object

Values in object and immediately related objects may be updated The object status can be changed to any valid active or inactive status. The object can be assigned to another user

Post-URL

Will post selected attribute information to a specified URL

Run Subprocess

A workflow configured for manual application can be called.

Stop

The Workflow can be completed or aborted and other workflow rules may be stopped as well. A .NET assembly created by a developer can be called from a workflow.

Update Object Change Status

Flow control

Short Description Create Task, Phone Call, Fax, or Letter activity

Call Assembly

TABLE 6 - WORKFLOW ACTIONS

Page

163

Microsoft CRM 3.0 Customization

Activity Creation Actions There are three types of Activity Creation Actions: •

Create Activity



Send e-mail



Create Note

Create Activity You can create an activity to guide parties involved with the object to complete tasks related to the business process. You can create the following types of activities: •

Task



Phone Call



Fax



Letter

The activity can be assigned to a specific user or to a logical user. Logical users include the owner of the object or the owner’s manager. NOTE: If the Logical user does not exist, for example if a manager is not defined or if the designated user is not active, then the workflow fails at the point where the activity is created. It will not proceed to other actions. These failures can be monitored and actions can be taken on these workflows. See Managing Workflows on p.225

When creating an activity: •

A Subject is required.



– The text of the Subject can be dynamic. A priority can be set.



A due date can be set based on the time the activity was created.



A Description can be provided. –

The text of the Description can be dynamic.

Procedure: Create Activity in Workflow 1. In the code pane, select the << add actions here >>, click Insert Action, and select Create activity. 2. On the Insert Action menu, click Create activity. The Create Activity form appears. 3. Next to the Assign to box, click the Lookup button. Page

164

Chapter 4: Workflow 4. In the Look Up Records form, do one of the following: a. From the Type list, select Logical User. b. The default selection is [owner]. To change the selection to [owner's manager], double-click [owner] in the Selected list and then double-click [owner's manager] in the Available list. c. Click OK OR a. From the Type list, select User. b. In the Find box, type a few letters of the name you want, and click Find. c. From the Available list, double-click the name you want. It will move to the Selected list. d. Click OK. 5. In the Subject box, type a subject title for the activity. 6. From the Priority list, select one of the following priorities: – High – Normal – Low 7. From the Type list, select the activity type you want. 8. Use the Due box to set the due date for the activity relative to when the activity is created by workflow. The Due box contains list boxes for months, days, hours, and minutes. 9. In the Description box, type a description of the activity. 10. Click OK.

Send E-Mail You can send e-mail messages from Workflow. This sends an e-mail immediately as the workflow is processed and adds a completed e-mail activity to the history area of the object. This completed e-mail activity stores a copy of the e-mail sent. When you select Send e-mail from the Insert Action menu options, you have the option to define the message in the workflow or use an existing E-Mail Template.

E-Mail Template When you use an e-mail template, everything is defined in the template, and all the remaining choices are disabled. When using an e-mail template the email address is set by the record type.

Page

165

Microsoft CRM 3.0 Customization

NOTE: Procedures for creating an e-mail template is not included in this course. See topic for more information.

Defined message If you do not use an e-mail template, you can specify Recipient information including "cc" and "Bcc" recipients. Recipients can be a logical user such as the object owner or the owner’s manager. Messages can also be sent to specific users, accounts or contacts. NOTE: Only e-mail addresses associated with a logical user are dynamic when sending a message defined in Workflow.

You can also specify an attachment with the message. This could be an item of sales literature. The message can be sent with a priority, a subject, and the body text of the message. The Subject and Description may include dynamic text.

Procedure: Send e-mail in Workflow 1. In the code pane, select the << add actions here >>, click Insert Action, and select send e-mail. 2. From the Insert Action menu, click Send e-mail. 3. In the Send E-mail form, do one of the following: – –

Click the Lookup button next to the Recipient box and go to Step 4. Select an e-mail template from the list.

NOTE: If you choose a template the template will determine the recipient’s subject and content automatically. The Recipient field is disabled when you select a template.

4. Locate the entity to which you want to send an e-mail. 5. Click the Lookup button next to the Cc box, and locate the entity to which you want to carbon copy. 6. Click the Lookup next to the Bcc box, and locate the entity to which you want to blind carbon copy. 7. Click the Browse button next to the Attachment box, and locate the attachment, if any, that you want to attach to the e-mail. NOTE: A file attached to an e-mail is validated for network security access privileges not just user access privileges. This applies whether the e-mail is manually executed or automatically triggered. Before attaching the file make sure that the file has network read privileges.

Page

166

Chapter 4: Workflow 8. Enter a subject in the Subject box. 9. Type the e-mail text in the Body text box. The text is contained in the preformatted tag (pre), which means any standard formatting of your text will be retained. You can use all the inline format elements except IMG, OBJECT, APPLET, BIG, SMALL, SUB, SUP, FONT, BASEFONT. 10 Click OK.

Create Note You can use notes to record information about the object. For example, you might want to record any automated workflow actions with corresponding notes to create a log of automated actions. When creating a note: •

The Subject field is required



– Subject may use dynamic text A Description can be provided



– Description can use dynamic text A file attachment can be specified with the note



If the Note is created by an event on an activity, the note can be attached to the regarding object. The regarding object is the record that the activity is associated with.

Procedure: Create Note in Workflow 1. In the code pane, select the << add actions here >>, click Insert Action, and select Create note. 2. In the Create Note form, you must enter information in the Subject box. Enter any other information you have for this note. For both a subject and a description, you can either enter text directly into the boxes, or click the Data Field Values button and select entity fields and default values to insert. 3. If you click the Data Field Values button, in the Data Field Values form, click an entity field in the list, enter a value in Default Value, and then click Insert Field. NOTE: You cannot select multiple fields on the list to insert at the same time. To insert more than one field you need to open the form for each one. If you want to attach a file click the Browse button next to the File attachment box select the file that you want to attach and click OK.

4. Click OK.

Page

167

Microsoft CRM 3.0 Customization

Object update Actions There are three types of Object update actions: •

Update Object



Change Status



Assign Object

Update Object Update related objects You can update the value of the fields of objects related to the workflow. For example, if the workflow is related to an opportunity, you can change values for the: •

Opportunity



Account or Contact the Opportunity is associated with



Owner of the Opportunity.

If the Call Assembly action is used, a value returned from the assembly can also be referenced. See Figure 2.

FIGURE 2 - OBJECTS THAT MAY BE UPDATED FROM A WORKFLOW ASSOCIATED WITH AN OPPORTUNITY

Page

168

Chapter 4: Workflow Update objects with values from related objects You can specify static values to update the object, but you can also set dynamic values by referencing values in other objects. NOTE: In this course, Dynamic values refer to the ability to set field values based on values from related objects. Dynamic Text refers to the ability to specify dynamic text fields in activities that use values from related objects in the text.

For example, the business process may require that the owner of an opportunity also be the owner of the Account associated with the Opportunity. This could be enforced from an Opportunity Workflow rule using "Update: Account. = Owner".

Invalid values Care should be taken when updating values in Workflow. Unlike the CRM application, workflow does not stop you from updating an object with an invalid value. If an invalid value is included, this does not necessarily cause the workflow to fail. The transaction is performed on the CRM platform. All data validation is performed in the CRM Application or through logic provided by a developer. IMPORTANT: As a workflow developer, you are responsible for making sure that you are including logic in the workflow to make sure that the value you update is valid.

For example, each object has a hierarchically linked Status and Status Reason attribute. If the status is "Active," the appropriate Status Reason may be "In Process." If the status is "Inactive," the appropriate Status Reason might be "Cancelled." In workflow, you can set the Status Reason to "Cancelled" even if the Status is "Active." You could not do this using the CRM application, but you can do this using Workflow. Update values not displayed on form Workflow allows you to update or reference object field values whether they are displayed on the entity form or not. This allows you to use these "hidden fields" to store values used in workflow without displaying them to users. For example, if the E-Mail Address 3 (emailaddress3) field is not displayed on Account Object form, you can still write to it using update object action in workflow. But it might be preferable to create a new attribute specifically for this purpose.

Page

169

Microsoft CRM 3.0 Customization Procedure: Configure Update Object Action 1. In the code pane, select the << add actions here >>, click Insert Action, and select Update entity. 2. In the Update Entity form, select an entity from the Entity list. 3. Select a field from the Field list. 4. Select an operator from the next list. 5. Complete the next box, the type of which depends upon your prior entries and choices. 6. Click OK.

Change Status Each Entity has different terms used to describe the status of any particular record. Most objects have "active" or "inactive" as the possible status values. However, some objects have more complex status values. For example, cases have the following status values: •

Active



Cancelled



Resolved

There is an opportunity for some confusion because the Application displays a label for "Status" or "State" at different times in the application and the Workflow tools. To understand this better, it might help to use the Schema Name.

Page

170

Chapter 4: Workflow See Table 7 for the statecode and statuscode values used by the Case and Lead entities. Object Case

Schema Name Display Name Schema Name Display Name statecode Active

"Status"

statuscode

"Status Reason"

In Progress On Hold Waiting for Details Researching

Lead

Cancelled

Cancelled

Resolved

Problem Solved

Open

New Contacted

Qualified

Qualified

Disqualified

Lost Cannot Contact No Longer Interested Cancelled

TABLE 7 - STATECODE AND STATUSCODE VALUES FOR THE CASE AND LEAD ENTITIES

statecode represents a platform defined set of values for specific entities that you cannot alter. For Custom entities, these are always "active" or "inactive". The "Change Status" action actually changes the statecode of the object. statuscode represents a set of values hierarchically linked to a particular statecode value. You can modify the available statuscode values using the entity customization tools Despite the name of the label in workflow manager, you should keep this clear in your mind. Under "Change Status" we have the ability to set the value of statecode. NOTE: The value for statuscode can be changed using the Update Object action discussed under Update Object on p.168.

Procedure: Configure Change Status Action 1. On the Insert Action menu, click Change Status. The Change Status form appears. 2. From the Change status to list, select the status to which you want the event to change. 3. Click OK.

Page

171

Microsoft CRM 3.0 Customization Assign Object Workflow allows you to assign objects.

Assign to Manager The object can be assigned to the Manager of the current owner. This requires that the user has a designated manager. If the user does not have a designated manager, the workflow fails on this action.

Assign to User Objects can be assigned to a specified user account.

Assign to Queue Cases and activities can be assigned to a queue. This routes the case or activity to a specific public queue defined in Microsoft CRM or to specific private queues available for each user. See Figure 3.

FIGURE 3 – QUEUES

Public Queue A public queue is monitored by customer service representatives. These appear in the Navigation Pane under Queues. They may accept a case from a queue and proceed to work with it. This moves it into the users Work in Process (WIP) bin queue. Private Queues There are two types of private queues:

Page

172



WIP Bin Queue



User Private Queue

Chapter 4: Workflow WIP Bin Queue The Work in Process (WIP) Bin queue stores those cases a specific user is actively working on. These appear in the application as the In Progress queue. If the case needs to be routed to a specific user, the case can be routed directly into that user’s WIP Bin Queue without requiring them to accept it. User Private Queue A user’s private queue represents those cases that have been assigned to a user but have not yet been accepted by the user. These appear in the application as the Assigned queue.

Flow Control Actions There are four types of flow control actions: •

Post URL



Run Subprocess



Stop



Call Assembly

Post URL After upgrading to Microsoft CRM 3.0 your existing V1.X style workflow rules are still supported. The Post URL action is deprecated in this version and will no longer be available in the Workflow Manager in future releases. New workflow rules should be written using the Call Assembly action. The Post-URL action sends data from the object that triggered the workflow event to a URL specified in the Post URL action. Post URL allows for a relatively simple, one-way transfer of data from one business application to another. The fields are sent in the http (or https) header and are available for processing by a dynamic web page (.asp, or aspx, page) designated in the URL. Post URL can be used to notify an external application on the extranet or intranet and provide that application with data that can be used.

Post-URL Shortcomings Post URL is not as robust as the Call Assembly action. There is no mechanism to detect whether or not the receiving web application was available to process the post. The post-URL process cannot process any response from the Web application. If the Web application designated by the URL is not available or does not respond within a specified time limit, the entire workflow pauses until someone manually detects it and restarts it using Workflow Monitor. Any logic in the workflow found after the Post-URL action will not be performed while it is paused.

Page

173

Microsoft CRM 3.0 Customization Mitigate Post-URL shortcomings If Post-URL is used in a workflow with other business logic, it should be used in a subprocess separate from other logic in the workflow or it should be the last action performed in the workflow.

Run Subprocess A subprocess is a way to group a set of actions and conditions to help simplify a lengthy workflow or improve maintainability of workflow. If you perform the same series of actions and conditions in more than one workflow, you should consider creating a subprocess. This allows you to make any future changes in one place rather than finding every separate location where that group of tasks is used. Only Manual events are available to be used as sub-processes.

Procedure: Configure Run Subprocess action 1. In the code pane, select the << add actions here >>, click Insert Action, and select Run subprocess. 2. From the Subprocess list, select the subprocess to run. 3. Click OK.

Stop A workflow stops when it is complete or if it is manually aborted using Workflow Monitor. NOTE: See Managing Workflows on p.225 for more information on using Workflow Monitor.

However, you also have the ability to tell the workflow when to stop using the Stop action. When you use the Stop action, you have four choices:

Page

174



Complete: Causes the current workflow rule to stop with status Complete.



Cancel: Causes the current workflow rule to stops with status Cancel.



Complete and stop processing other rules: Causes the current workflow rule to stop with status Complete and stops triggering further workflow rules for that event.



Cancel and stop processing other rules: Causes the current workflow rule to stop with status Cancel and stops triggering further workflow rules for that event.

Chapter 4: Workflow Procedure: Configure Stop Action 1. In the code pane, select the << add actions here >>, click Insert Action, and select Stop. 2. In the Stop form, choose the type of stop action 3. Click OK.

Call Assembly You can call a web service or any .NET assembly from workflow. Unlike PostURL, the result returned from the web service or .NET assembly can then be referenced in further conditions and actions in the workflow. This allows great extensibility to your workflow solution. NOTE: The result returned from an assembly represents a variable that can be referenced in logic within the workflow. It appears as a separate related object when assigning dynamic values.

The specific details to create an assembly are beyond the scope of this course, but it is important that you understand some of the basics so that you can work with a developer to leverage this capability. It is expected that ISV developers will offer custom assemblies with a variety of functions and capabilities.

Call a Web Service Web services are not called directly. Web services calls are treated as a special kind of .NET assembly calls. To call a web service, you first provide a proxy assembly. Then you can reference this assembly in the workflow rule editor. NOTE: A client and a Web service communicate using Simple Object Access Protocol (SOAP) messages. The Web service proxy is responsible for the formation of the SOAP messages and sending them across the network. This makes it possible to consume a Web service because it is not necessary to map out your parameters to XML elements. The Web service proxy consists of a dynamic-link library (DLL) on the local Web server. Using a utility that ships with the .NET Framework SDK called WSDL.exe, you can generate a Microsoft Visual Basic® .NET or C# source code file and then use that file to compile a Web service proxy.

Page

175

Microsoft CRM 3.0 Customization .NET assembly A .NET assembly is a .dll file. Any .NET assembly can be used. There is no need to sub-class or implement a particular interface in an assembly. A .dll file that is not a .NET assembly cannot be used. Assemblies need to be copied to the PROGRAM FILES\MICROSOFT CRM\SERVER\BIN\ASSEMBLY folder

How it all works together Figure 4 describes how the Call Assembly actions are configured and operated.

FIGURE 4 - WORKFLOW CALL ASSEMBLY PROCESS

1. The developer Generates an assembly. 2. The developer or System Administrator modifies the workflow.config file. 3. The workflow.config file references methods in the assemblies. 4. Workflow Manager displays information from workflow.config. 5. A user creates a workflow rule using Workflow Manager. 6. The Workflow service executes the workflow rule. 7. The Workflow service executes the assembly as part of the workflow rule.

Page

176

Chapter 4: Workflow Workflow.config Workflow.config is an XML file located at PROGRAM FILES\MICROSOFT CRM\SERVER\BIN\ASSEMBLY. This is the same location that the assembly must be copied to. Detailed information about configuring the workflow.config file can be found in the Microsoft CRM SDK.

Microsoft.Crm.Platform.WorkflowAssembly.dll Microsoft CRM 2.0 has an assembly to give some useful datetime functions. This assembly also demonstrates how a configured Call Assembly action is used. The Microsoft.Crm.Platform.WorkflowAssembly.dll provides two methods: •

Add DateTime



Subtract DateTime

These methods can be used to modify date time values for objects in Workflow. Either of these methods also allows you to reference a DateTime value even if you do not intend to modify that time.

Procedure: Use the Add DateTime call assembly action. 1. In the code pane, select the << add actions here >>, click Insert Action, and select Stop. 2. From the Insert Action menu, click Call Assembly. 3. On the Call Assembly side menu, click Date Time Functions, and then click one of the following options: –



Add date and time: Create a date and time action that adds the specified number of years, months, days, hours, or minutes to the date and time value. Subtract date and time: Create a date and time action that subtracts the specified number of years, months, days, hours, or minutes to the date and time value.

4. In either the Add DateTime or Subtract DateTime form, click in the Action Name box and enter a name. 5. In the Parameter column, double-click Date Time. 6. In the Select Value form, you can select either Static Value, click the Search button to select either Execution Time, or Static Date Time, or Dynamic Value to select an entity and field. 7. Click OK. 8. Double-click any of the other parameters that you want to set. 9. When you have completed setting values in the Select Value form, click OK.

Page

177

Microsoft CRM 3.0 Customization

Using Dynamic Text in Workflow Dynamic Text Field Support Workflow Manager allows for the insertion of dynamic text areas, sometimes referred to as "slugs." Dynamic text can be added to the Subject and Description areas of an activity. The Workflow Manager user interface is very similar to the E-mail template user interface.. Adding Dynamic Text is a process of: •

Adding a field



Specifying default text



Inserting the Data value into the field

Adding a field When adding a field, you can include several fields at a time. This does not concatenate the fields together. Rather, this establishes an order in which the fields are evaluated. The first non-null field is the one included in the text.

Specifying default text When adding a field, you can specify text to be included when the field(s) are null. If you include multiple fields and all of them are null, the default text is added. For example: If you create a data value that is: {!Account.Account Number;Account.Account Name;NO DATA}

These are the results you can expect: Case 1: Account Number = 123 Account Name = "All Cycle Shop" Result = "123". Case 2: Account Number = NULL Account Name = "All Cycle Shop" Result = "All Cycle Shop" Case 3: Account Number = NULL Account Name = NULL Result = "NO DATA" NOTE: If no default text is specified and the data field(s) resolves to NULL, no text is added.

Page

178

Chapter 4: Workflow Inserting the Data value into the field Once you have specified the field(s), you can insert the field into the text area, and you can type additional static text into the subject or description. After the data value has been entered, it can be edited by double clicking on it. NOTE: Unlike e-mail templates, you cannot re-size the area in which the text is displayed. It is not necessary. The data will not be truncated if the size is too small. The user interface does display blue handles around the dynamic text area which you can select and move with the cursor, but do not be distracted by them. They do not have any functionality and will just snap back.

Inserting DateTime values When you include DateTime values as text, they are formatted to show the time zone. The time zone displayed depends on whether the object that the workflow is associated with is bound to a particular Site. At this time, Service Activities are the only objects that can be bound to a Site.

Service Activity DateTime values. Resources Service activities can be associated with a site. If they are, DateTime values related to them are displayed according to the Time zone of the site. Because of this, you can send an e-mail associated with a Service Activity to a customer showing a time in the appropriate time zone.

Other DateTime values For DateTime values associated with other objects, the DateTime values correspond to the location of the CRM Server. The DateTime value is displayed along with a GMT adjustment. See Table 8. Depending on where the CRM Server is located, the same moment in time will display differently. All users using the same server will see the same text regardless of the time zone they are in. CRM Server Location

Displayed DateTime Text

Los Angeles, USA

06/30/2006 2:30 PM (GMT-08:00) Pacific Time (US & Canada); Tijuana

UK

06/30/2006 10:30 PM (GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London

Japan

07/01/2006 6:30 AM (GMT+09:00) Osaka, Sapporo, Tokyo

TABLE 8 - DATETIME TEXT VALUES BY CRM SERVER LOCATION

Inserting Boolean values Despite the fact that Boolean entity attributes can have a custom text string associated with the values, dynamic text in workflow does not use these values. All Boolean values are interpreted as 0= "No", 1= "Yes".

Page

179

Microsoft CRM 3.0 Customization For example, the Account.DoNotPostalMail attribute is configured in the Attribute Customization tool with the text values 0="Allow", 1="Do Not Allow". However, the dynamic text results of the "slug": {!Account.DoNotPostalMail}

will be either Allow = "No" or Do Not Allow = "Yes".

Using Dynamic Values in Workflow Dynamic values can also be used when testing conditions or setting values when updating objects in workflow.

FIGURE 5 - SELECT VALUE DIALOG

The Select value dialog allows you to choose between setting a Static value or a Dynamic value.

Static value The behavior of the static value field depends on the datatype of the field. For certain datatypes, a lookup button is enabled that validates that the data is the correct type.

Dynamic Value The dynamic value allows you to choose a value from any of the related objects. In addition to related objects, the result of a .NET assembly method appears as an object that can be used to set a dynamic value. You might use this to capture a DateTime value from one object and use that value to set the value of another object.

Page

180

Chapter 4: Workflow

Workflow Action Demonstrations and Labs In this section, the Instructor demonstrates each of the Workflow actions. A Lab follows each demonstration.

Creating a Workflow A Workflow rule must be created for both the Demonstrations and the lab. The steps to create a workflow can be found under Procedure: Create a Workflow Rule on p.155.

Demonstration: Activity Creation Actions This demonstration will apply each of the Activity Creation Actions.

Scenario A new add-on product has been developed. In an effort to sell this new product to existing customers, this workflow will be used to initiate steps in approaching these existing customers. A list has been created identifying all Accounts who own the product.

Goals •

Create a phone call activity for the owner of the Account.



Create a note on the Account to log that they have been identified as a prospect for this new product.



Create an e-mail activity to send a message to the account advising them to expect a call from the Opportunity Owner.

Steps Step 1: Create a workflow rule Create a manual workflow rule on the account object called "Account Actions".

Step 2: Create Phone Call Activity Use the information in Table 9 to create a phone call activity. Subject

Call about new Product

Type

Phone Call

Priority

Normal

Due

2 days later

Description

Call and tell them about the new product.

TABLE 9 - PHONE CALL ACTIVITY SETTINGS

Page

181

Microsoft CRM 3.0 Customization Step 3: Create Note Use the information in Table 10 to create a note on the Account. Subject:

New Product Prospect

Note text:

This Account has been identified as a prospect for the new product

File Attachment

C:\Customization\Ch4\New Product Brochure.pdf

TABLE 10 - NOTE SETTINGS

Step 4: Create E-Mail Use or Create an Email template to be included in the Email. NOTE: In the classroom for course #### this template has been created in the CRM Implementation.

Title:

For New Product

Subject:

For {!Account :Account Name;Valued Customer}

Note text:

Hi We have a new product that I’d like to talk to you about. I’ll give you a call in a couple days. If you have any questions contact {!User : Full Name; Your sales representative..} at Adventure Works Cycle Best Regards, {!User : First Name:}

TABLE 11 - E-MAIL TEMPLATE SETTINGS

This email uses three "slugs" to create Dynamic text. These slugs are configured using the information in Table 12. Field

Default Value

Account : Account Name

Valued Customer

User : Full Name

Your sales representative

User : First Name TABLE 12 - DYNAMIC TEXT VALUES

Page

182

Chapter 4: Workflow Step 5: Test the Rules 1. Select an Account record from a view and select MORE ACTIONS→ APPLY RULE... 2. Select the Account Actions Workflow and Click OK. 3. Open the Account and click Activities. You should see a new phone call activity with the subject "Call about new product". 4. Click History. You should see an e-mail activity that has been completed. This indicates that the message has been sent. 5. Click Information and then click the Notes tab. You should see a note with the New Product Brochure attachment.

Page

183

Microsoft CRM 3.0 Customization

Lab 4.1 Activity Creation Actions Use the information in the Scenario and Goal Description to complete a set of Activity Creation Actions.

Scenario A new add-on product has been developed. In an effort to sell this new product to existing customers, this workflow will be used to initiate steps in approaching these existing customers. A list has been created identifying all Contacts who own the relevant product.

Goals Using workflow configure these activity creation actions. •

Create a phone call activity



Create a note



Create an e-mail activity.

Create a phone call activity The phone call activity will be created using the settings in Table 13. Subject

Call about new Product

Type

Phone Call

Priority

Normal

Due

2 days later

Description

Call and tell them about the new product.

TABLE 13 - PHONE CALL ACTIVITY SETTINGS

Create a note The note will be created using the settings in Table 14. Subject:

New Product Prospect

Note text:

This Contact has been identified as a prospect for the new product

File Attachment

C:\Customization\Ch4\New Product Brochure.pdf

TABLE 14 - NOTE SETTINGS

Page

184

Chapter 4: Workflow Create an e-mail activity The e-mail activity will use an email template described in Table 15. NOTE: In the classroom for course #### this template has been created in the CRM Implementation.

Title:

For New Product

Subject:

For {!Contact : Full Name; Valued Customer}

Note text:

Hi We have a new product that I’d like to talk to you about. I’ll give you a call in a couple days. If you have any questions contact {!User : Full Name; Your sales representative..} at Adventure Works Cycle Best Regards, {!User : First Name:}

TABLE 15 - E-MAIL TEMPLATE SETTINGS

Instructions Challenge Yourself (Level 3) Using the information in the Goal Description configure the Contact Actions Workflow rule to perform the following actions. 1. Create a manual Workflow rule on the Contact Object called "Contact Actions". 2. Create Phone Call Activity. 3. Create Note. 4. Create E-Mail.

Need a little help? (Level 2) Step 1: Create a workflow rule Create a manual workflow rule on the Contact object called "Contact Actions". Step 2: Create Phone Call Activity 1. Open the Contact Actions workflow rule. 2. Click INSERT ACTION→CREATE ACTIVITY. 3. Use the information in Table 13 to create a phone call activity.

Page

185

Microsoft CRM 3.0 Customization Step 3: Create Note 1. Click Insert ACTION → CREATE NOTE 2. Use the information in Table 14 to create a note on the Contact. Step 4: Create E-Mail 1. Click INSERT ACTION → SEND EMAIL. 2. Use the "For New Product" e-mail template described in Table 15. 3. Save and activate the Contact Actions workflow rule.

Step 5: Test the Rules 1. Apply the Contact Actions Workflow to a Contact record. 3. Open the Contact and click Activities. You should see a new phone call activity with the subject "Call about new product". 4. Click History. You should see an e-mail activity that has been completed. This indicates that the message has been sent. 5. Click Information and then click the Notes tab. You should see a note with the New Product Brochure attachment.

Demonstration: Object Update Actions Apply each of the Object Update Actions to an Account.

Scenario A group of Accounts have not ordered any products for nearly two years. Using workflow, the accounts will be updated, assigned, and deactivated.

Goal This demonstration will include the following actions:

Page

186



Set the account relationship type to "prospect".



Assign the accounts to Patricia San Juan.



Deactivate the account.

Chapter 4: Workflow Steps 1. Before you begin, create a copy of the Account Actions workflow rule and name it Account Update Actions. 2. Delete the Activity creation actions from the previous demonstration.

Step 1: Set the account relationship type to "prospect" 1. Click INSERT ACTION → UPDATE OBJECT. 2. Select Object = "Account" and Field = "Relationship Type". 3. Select the "=" operator and click the lookup button. 4. With the Static Value radio button selected, click the drop-down control and select "Prospect". 5. Click OK to close the Select Value screen. 6. Click OK to close the Update Object action.

Step 2: Assign the Account to Patricia San Juan 1. Click Insert ACTION → ASSIGN OBJECT. 2. Select User and click the Assign to lookup button. 3. In the Lookup records screen, search for Patricia San Juan and add her to the selected area. 4. Click OK to close the Lookup Records screen. 5. Click OK to close the Assign Object screen.

Step 3: Deactivate the Account 1. Click INSERT ACTION → CHANGE STATUS 2. Select Inactive. 3. Click OK. 4. Save the Account Update Actions Workflow Rule.

Page

187

Microsoft CRM 3.0 Customization Step 4: Test the Rules 1. Activate the Account Update Actions Workflow rule. 2. Go to the Accounts no placed order in last 6 months view. 3. Select one or more accounts. 4. Select More Actions → Apply Rule. 5. Select Account Update Actions and click OK. 6. Go to the Inactive Accounts view. 7. You should see the Accounts that you applied the rule to. 8. Open the accounts and confirm that they are assigned to Patricia San Juan and have a Relationship Type of "Prospect".

Page

188

Chapter 4: Workflow

Lab 4.2 Object Update Actions In this lab you will apply Object Update Actions to Contacts.

Scenario A group of Contacts have requested that they not be contacted. Using workflow, the Contacts will be updated, assigned, and deactivated.

Goal This demonstration will include the following actions: •

Set the all the allowed Contact methods to "Do not allow".



Assign the Contacts to Patricia San Juan.



Deactivate the Contacts.

Instructions 1. Before you begin, create a copy of the Contact Actions workflow rule and name it Contact Update Actions. 2. Delete the Activity creation actions from the previous lab.

Challenge Yourself (Level 3) Use the information in the scenario and goal description to configure a workflow to : 1. Set the contact methods to "Do not allow". 2. Assign the Contacts to Patricia San Juan. 3. Deactivate the Contacts.

Need a little help? (Level 2) Step 1: Set the Contact methods to "Do not allow" 1. Click INSERT ACTION → UPDATE OBJECT. 2. Select Object = "Contact" and Field = "Do not allow Bulk E-mails". 3. Select the "=" operator and click the lookup button. 4. With the Static Value radio button selected, click the drop-down control and select "True".

Page

189

Microsoft CRM 3.0 Customization 5. (Optional) Repeat instructions 1-4 for each of the following fields: – – – – –

Do not allow Bulk Mails. Do Not allow E-Mails. Do not allow Faxes. Do not allow Mails. Do not allow Phone Calls.

Step 2: Assign the Account to Patricia San Juan 1. Click INSERT ACTION → ASSIGN OBJECT. 2. Select User and click the Assign to lookup button. 3. In the Lookup records screen, search for Patricia San Juan and add her to the selected area. Step 3: Deactivate the Account 1. Click INSERT ACTION → CHANGE STATUS 2. Select Inactive. Step 4: Test the Rules 1. Save and activate the Contact Update Actions Workflow Rule. 2. Go to the Contacts not placed order in last 6 months view. 3. Select one or more Contacts. 4. Select MORE ACTIONS → APPLY RULE. 5. Select Contact Update Actions and click OK. 6. Go to the Inactive Contacts view. 7. You should see the Contacts that you applied the rule to. 8. Open the Contacts and view the Administration tab to confirm that they are assigned to Patricia San Juan and have at least the Bulk EMail Contact Method set to "Do not Allow".

Page

190

Chapter 4: Workflow

Demonstration: Flow Control Actions NOTE: Because Post-URL is deprecated in this release, it is not included in this demonstration

Apply the Flow control Actions in a workflow. NOTE: This workflow requires the Description Field. Create a new Tab and Section called "Description" to and add this field to it..

Scenario Simply introduce the Flow Control Actions.

Goal This demonstration will include three actions: •

Use the Call Assembly action to update the account description field with the date that is the first anniversary of the creation of the account record.



Call the Account Actions workflow rule as a subprocess.



Stop the workflow before later actions performed.

The final workflow rule should look like Table 16.

Manual Rule Add DateTime: First_Anniversary Update: Account.Description = First Anniversary = Update: Account.Description += First_Anniversary Exec: Account Actions Stop Exec: Account Actions TABLE 16 - FLOW CONTROL ACTIONS DEMONSTRATION

Steps 1. Before you begin, create a copy of the Account Actions workflow rule and name it Account Flow Control Actions. 2. Delete any actions from the previous demonstration.

Page

191

Microsoft CRM 3.0 Customization Step 1: Call Assembly 1. Select INSERT ACTION → CALL ASSEMBLY → DATE TIME FUNCTIONS → ADD DATE TIME. 2. Enter "First_Anniversary" in the Action Name Field. 3. Double click the Date Time Parameter. 4. Select Dynamic Value. 5. Select the Account CreatedOn field. 6. Double click the Years Parameter. 7. Enter "1" as a static value. 8. Select INSERT ACTION → UPDATE OBJECT. 9. Set the Account Description field = "First Anniversary = ". NOTE: This is a test value that will identify the First_Anniversary date time value

10. Use the "+=" operator to append to the existing description text. 11. Open the lookup window and select the Dynamic Value "First_Anniversary".

Step 2: Run Sub Process 1. Select INSERT ACTION → RUN SUBPROCESS 2. Select the Account Actions subprocess that was created in Demonstration: Activity Creation Actions on page 181. NOTE: You won’t be able to add this workflow rule as a subprocess if it doesn’t exist or is not activated.

Step 3: Stop 1. Select INSERT ACTION → STOP. 2. Select Complete and click OK. NOTE: In order to confirm that the process actually stops, include the same call to a subprocess included in Step 2.

Page

192

Chapter 4: Workflow 3. Select INSERT ACTION → RUN SUBPROCESS 4. Select the Account Actions rule.

Step 4: Test the Rules 1. Save and Activate the Account Flow Control Actions workflow rule. 2. Open an Account in Microsoft CRM and select ACTIONS→APPLY RULE. 3. Select the Account Flow Control Actions rule. 4. Close and re-open the Account. 5. Note the following: – – –

The Description field on the Details Tab says "First Anniversary = . There is one Phone Call Activity for "Call about new Product". There is one E-Mail Activity called "For in the History area.

Page

193

Microsoft CRM 3.0 Customization

Lab 4.3 Flow Control Actions NOTE: Because Post-URL is deprecated in this release, it is not included in this lab.

This lab will guide you through using basic flow control actions NOTE: This workflow requires the Description Field. Create a new tab and section called Description to and add this field to it.

Scenario Confirm the behavior of basic flow control Actions.

Goal Description This lab will include three actions: •

Use the Call Assembly action to update the contact description field with the date that is the first anniversary of the creation of the contact record.



Call the Contact Actions workflow rule as a subprocess.



Stop the workflow before later actions performed.

The final workflow rule should look like Table 17.

Manual Rule Add DateTime: First_Anniversary Update: Contact.Description = First Anniversary = Update: Contact.Description += First_Anniversary Exec: Contact Actions Stop Exec: Contact Actions TABLE 17 - CONTACT FLOW CONTROL ACTIONS

Instructions 1. Before you begin, create a copy of the Contact Actions workflow rule and name it Contact Flow Control Actions. 2. Delete any actions from the previous demonstration.

Page

194

Chapter 4: Workflow Challenge Yourself (Level 1) Use the information in the scenario and goal description to configure a workflow to : 1.

Call Assembly.

2.

Run Sub Process.

3.

Stop.

Need a little help (Level 2) Step 1: Call Assembly 1. Select INSERT ACTION → CALL ASSEMBLY → DATE TIME FUNCTIONS → ADD DATE TIME. 2. Enter "First_Anniversary" in the Action Name Field. 3. Set the Date Time parameter equal to the Contact CreatedOn date. 4. Set the Years parameter = 1. 5. Use an Object Update action to update the Contact Description field = "First Anniversary = ". NOTE: This is a test value that will identify the First_Anniversary date time value

6. Use an Object Update action to update the Contact Description field. 7. Use the "+=" operator to append to the existing description text. 8. Select the Dynamic Value "First_Anniversary" object. Step 2: Run Sub Process 1. Select INSERT ACTION → RUN SUBPROCESS 2. Select the Contact Actions subprocess that was created in Lab 4.1. NOTE: You won’t be able to add this workflow rule as a subprocess if it doesn’t exist or is not activated.

Page

195

Microsoft CRM 3.0 Customization Step 3: Stop 1. Select INSERT ACTION → STOP. 2.

Select Complete and click OK.

NOTE: In order to confirm that the process actually stops, include the same call to a subprocess included in Step 2 after the stop

Step 4: Test the Rules 1. Save and Activate the Contact Flow Control Actions workflow rule. 2. Open a Contact in Microsoft CRM and apply the Contact Flow Control Actions rule. 3. Note the following: – – –

The Description field on the Details Tab says "First Anniversary = . There is one Phone Call Activity for "Call about new Product". There is one E-Mail Activity called "For in the History area.

Defining Workflow Conditions Workflow rules can include conditions to control the actions that are performed. These conditions can be grouped into two levels: •

Basic Conditions



Specific Conditions

In the Workflow Manager, the Basic Condition is chosen before the Specific Condition can be applied. See Table 18.

Page

196

Chapter 4: Workflow

Basic Condition

Specific Condition

Description

Check

Check object

Checks a field within the object. This conditional construct consists of the parameters Object, Field, Operator, and Values. The operators are based on the data type for that field to be evaluated.

Check Activities

This condition returns a value of true if any activities are created by users during the specified time period. You also have the option to include activities created by the workflow. This condition is not available when the bound object is not an activity. See Check Activities Condition below.

Else If

Adds an additional condition, stating if the first condition is not valid, then see if another condition is valid.

Wait Object

Checks if a field within the record type has a certain value before continuing.

Wait Activity

Used when an activity is created in a previous step and the rule is set to wait to continue until the activity reaches the status set in the condition. The wait activity condition can be set as Completed, Skipped, or Either before continuing the rule.

From now on

Allows for entry of a static time period to wait from the moment of execution. The time period can be up to 25 months.

After

Allows for entry of a static time period to wait after a related object was created. This can include a time referenced in an assembly. The expression can also be reevaluated to compare other datetime values on the bound object when those fields are updated.

Before

Allows for entry of a static time period to wait before a date time. This might be used to send a reminder e-mail based on the start time of an appointment.

Wait For

Wait for Timer

TABLE 18 - WORKFLOW CONDITIONS

Check Condition The Check condition creates an "if..then...end if" structure for the more specific check conditions to be evaluated and then actions to be performed if they are true.

Page

197

Microsoft CRM 3.0 Customization Check Activities Condition The Check Activities condition is normally used in conjunction with a Wait for Timer condition. It is used to determine if any Activities have occurred in a specified time frame. If no time frame or condition is specified, the Check Activities condition checks for Activities dating back to the creation of the object. The Check Activities condition returns a True when Activities exist for an object. In cases where you want to check for an absence of Activities, you must add an Else If statement to specify further action.

Demonstration: Check Conditions This Demonstration will illustrate how Check Conditions can be applied when using workflow

Scenario Adventure Works Cycle wants to send a Customer Reconnect e-mail to accounts who have had no activities associated with them and have not asked that e-mails not be sent.

Goal Create a workflow rule that will send an e-mail only if the Account has no previous activities associated with it and the account does not allow e-mails. Create a note on the Account to explain what was done. The finished Workflow will look like Table 19.

Manual Rule if Check any activities created for this object then Note: Check Object Conditions Test A else if Account.Do not allow E-mails = False then Note: Check Object Conditions Test B E-mail Template: Customer Reconnect end if TABLE 19 - ACCOUNT CHECK CONDITIONS WORKFLOW

Page

198

Chapter 4: Workflow Steps Create a Manual Workflow Rule called Account Check Conditions.

Step 1: Check Activities 1. Click INSERT CONDITION → CHECK CONDITIONS 2. Select the <> area 2. Click INSERT CONDITION → CHECK ACTIVITIES 3. Select the <> area. 4. Click INSERT ACTION → CREATE NOTE 5. Enter the information in Table 20. Subject

Check Account Conditions Test A

Descriptions:

This Account has activities associated with it

TABLE 20 - CHECK OBJECT NOTE A

6. Click OK.

Step 2: Else If 1. Select the "if" section of the Check Condition you created in Step 1. 2. Click INSERT CONDITION → ELSE IF. NOTE: This will add an else if condition to the check statement.

3. Select the <> area in the else if clause. 4. Click INSERT ACTION → CREATE NOTE. 5. Enter the information in Table 21. Subject

Check Account Conditions Test B

Descriptions:

This account had no activities associated with it and allows e-mail. An e-mail was sent

TABLE 21 - CHECK OBJECT NOTE B

6. Click OK.

Page

199

Microsoft CRM 3.0 Customization 7. Click INSERT ACTION → SEND E-MAIL. 8. Select the Custom Reconnect Template and click Create E-mail.

Step 3: Check Objects 1. Select the remaining <> area and click INSERT CONDITION → CHECK OBJECT CONDITIONS. 3. Select the Do Not allow E-Mails field of the Account object. 4. Select the equality operator "=". 5. Click the lookup button to select the static value "False".

Step 4: Test the Rules 1. Activate the Account Check Conditions rule. 2. Create a new Account and include the email address "[email protected]". 3. Save the Account. 4. Select ACTIONS → APPLY RULE. 5. Select the Account Check Conditions rule and click OK. 6. Close and re-open the account you created. 7. Check the Details tab. You should see the message: "This account had no activities associated with it and allows e-mail. An e-mail was sent". 8. Check the History tab to confirm that an e-mail was sent. 9. Apply the Account Check Conditions rule again. 10. Close and re-open the account. 11. Check the Details tab. You should see the message "This Account has activities associated with it".

Page

200

Chapter 4: Workflow

Lab 4.4 Check Conditions This lab requires you use Check Conditions in workflow.

Scenario Adventure Works Cycle wants to send a Customer Reconnect e-mail to contacts who have had no activities associated with them and allow e-mails.

Goal Create a workflow rule that will send an e-mail only if the Contact has no previous activities associated with it and allow e-mails. Create a note on the Contact to explain what was done. The finished Workflow will look like Table 22.

Manual Rule if Check any activities created for this object then Note: Check Contact Conditions Test A else if Contact.Do not allow E-mails = False then Note: Check Contact Conditions Test B E-mail Template: Customer Reconnect end if TABLE 22 - CONTACT CHECK CONDITIONS WORKFLOW

The Notes applied to the Contact will use the information in Table 23 and Table 24 Subject

Check Contact Conditions Test A

Descriptions:

This Contact has activities associated with it No e-mail was sent

TABLE 23 - CHECK CONTACT NOTE A

Subject

Check Contact Conditions Test B

This Contact had no activities associated with it and allows eDescriptions: mail. An e-mail was sent TABLE 24 - CHECK CONTACT NOTE B

Page

201

Microsoft CRM 3.0 Customization Instructions Create a Manual Workflow Rule on the Contact object called Contact Check Conditions.

Challenge Yourself (Level 3) Use the information in the Goal Description to complete the following steps: 1.

Check Activities

2.

Else If

3.

Check Objects

4.

Test the Rules

Need a Little Help (Level 2) Steps Step 1: Check Activities 1. Click INSERT CONDITION → CHECK CONDITIONS. 2. Select the <> area. 2. Click I INSERT CONDITION → CHECK ACTIVITIES. 3. Select the <> area.. 4. Click INSERT ACTION → CREATE NOTE. 5. Enter the information in Table 23. Step 2: Else If 1. Select the "if" section of the Check Condition you created in Step 1. 2. Click INSERT CONDITION → ELSE IF. NOTE: This will add an else if condition to the check statement.

3. Select the <> area in the else if clause. 4. Click INSERT ACTION → CREATE NOTE. 5. Enter the information in Table 24. 6. Click INSERT ACTION → SEND E-MAIL. 8. Select the Marketing Event Notification Template and click Create E-mail.

Page

202

Chapter 4: Workflow Step 3: Check Objects 1. Select the remaining <> area and click INSERT CONDITION → CHECK OBJECT CONDITION. 2. Check the "Do Not allow E-Mails" field = false. Step 4: Test the Rules 1. Create a new Contact and include the email address "[email protected]". 2. Apply the Contact Check Conditions rule. 3. Check the Contact Details tab. You should see the message: "This Contact had no activities associated with it and allows e-mail. An email was sent". 4. Check the History tab to confirm that an e-mail was sent. 5. Apply the Contact Check Conditions rule again 6. Check the Details tab. You should see the message "This Contact has activities associated with it. No e-mail was sent".

Demonstration: Wait for Conditions This Demonstration will illustrate how Wait For Conditions can be applied when using workflow

Scenario Adventure Works Cycle has two categories of customer:; Preferred Customer and Standard. When a customer is awarded "Preferred Customer" Status they will receive some special benefits. A Sales person will contact them to explain the benefits and send them a letter with details. To facilitate this process, Adventure Works Cycle uses a Wait for condition in a workflow associated with the Create event for the Account object.

Goal Create a workflow on the Create event of the account object This workflow will: 1. Wait until the Account Category field is set to "Preferred Customer". 2. Send the Account an e-mail using the Preferred Customer Status email template.

Page

203

Microsoft CRM 3.0 Customization

NOTE: In the Classroom for course #### the Preferred Customer Status email template has been included in the classroom installation. If you are not using the classroom installation, you can use an alternative Account e-mail template.

3. Create a phone call activity for the owner of the Account to have them introduce the Preferred Customer Program. 4. After the Phone call activity has been completed, the owner of the Account will be assigned a letter activity to send the Account the details. The finished Workflow will look like Table 25.

When account is created wait Account.Category = Preferred Customer end wait E-mail Template: Preferred Customer Status Phone Call: Discuss Preferred Customer Benefits wait Phone Call: Discuss Preferred Customer Benefits is completed end wait Letter: Preferred Customer information TABLE 25 - ACCOUNT WAIT FOR CONDITIONS WORKFLOW

Steps Create a Workflow Rule on the Create event of the Account object called Account Wait for Conditions.

Step 1: Wait Object 1. Click INSERT CONDITION → WAIT FOR CONDITIONS. 2. Click the <> area and select INSERT CONDITION → WAIT OBJECT CONDITION 3. Select the Category field for the Account object and check for the Static Value "Preferred Customer" 4. After the end wait section, use INSERT ACTION → SEND E-MAIL to send an e-mail using the Preferred Customer Status template.

Page

204

Chapter 4: Workflow 5. After the e-mail, create a Phone Call using the details in Table 26.

Subject:

Discuss Preferred Customer Benefits

Description:

Tell them all the benefits of being a preferred customer

Due

2 days later

TABLE 26 - PHONE CALL ACTIVITY DETAILS

Step 2: Wait Activity 1. After the phone call activity click INSERT CONDITION → WAIT FOR CONDITIONS. 2. Select the <> area and click INSERT CONDITION → WAIT ACTIVITY CONDITION. 3. Select the "Phone Call: Discuss Preferred Customer Benefits" in the drop-down and select "completed". 4. After the end wait, click INSERT ACTION → CREATE ACTIVITY. Add a Letter activity using the information in Table 27. Subject:

Preferred Customer Information

Description:

Send Details on the Preferred Customer Program

Due

2 days later

TABLE 27 - LETTER ACTIVITY DETAILS

Step 3: Test the Rules 1. Save and Activate the Account Wait For Conditions Workflow. 2. Create a new account with the e-mail address "[email protected]". 3. Save, close, and re-open the new account. 4. Check that there are no activities in the history area. 5. Set the Account Category to "Preferred Customer" then save and close the account. 6. Open the Account again. Note the following: – –

A completed e-mail activity in the history area A Phone call Activity

Page

205

Microsoft CRM 3.0 Customization 7. Open the Phone Call Activity and click Save as Completed. 8. Close and re-open the Account. 9. Check that the Letter Activity has been added.

Page

206

Chapter 4: Workflow

Lab 4.5 Wait for Conditions This lab requires you use Wait for conditions in workflow.

Scenario Adventure Works Cycle wants to send Contacts an e-mail when their payment terms changes. This e-mail is followed by a phone call from the Contact owner. After the Phone Call is completed, the owner is then assigned a Letter activity to send the details on the conditions of the payment terms to the Contact.

Goal Description Create a workflow rule on the Create event of the Contact object. This workflow will: 1. Wait until the Contact Payment terms field is set to "Net 60". 2. Send the Contact an e-mail using the Change in Payment terms email template. NOTE: In the Classroom for course #### the Change in Payment Terms email template has been included in the classroom installation. If you are not using the classroom installation, you can use an alternative Contact e-mail template.

3. Create a phone call activity for the owner of the Contact to explain conditions of the Net 60 payment terms. 4. After the Phone call activity has been completed, the owner of the Account will be assigned a letter activity to send the Contact details of the conditions of the Net 60 payment terms. The finished Workflow will look like Table 28.

When contact is created wait Contact.Payment Terms = Net 60 end wait E-mail Template: Change in Payment Terms Phone Call: Explain details of change in payment terms wait Phone Call: Explain details of change in payment terms end wait Letter: Change in Payment Terms TABLE 28 - CONTACT WAIT FOR CONDITIONS WORKFLOW

Page

207

Microsoft CRM 3.0 Customization The Phone Call and Letter activities will use the information in Table 29 and Table 30 respectively. Subject:

Explain details of Change in Payment terms

Description:

Explain the conditions that the NET 60 payment terms require.

Due

2 days later

TABLE 29 - PHONE CALL ACTIVITY DETAILS

Subject:

Change in Payment Terms

Description:

Send Details on the conditions of the NET 60 payment terms

Due

2 days later

TABLE 30 - LETTER ACTIVITY DETAILS

Instructions Create a Workflow Rule on the Create event of the Contact object called Contact Wait for Conditions.

Challenge Yourself (Level 3) Use the information in the Goal Description to complete the following steps. 1. Wait Object 2. Wait Activity 3. Test the Rules

Need a Little Help (Level 2) Step 1: Wait Object 1. Click INSERT CONDITION → WAIT FOR CONDITIONS. 2. Select the <> area and select INSERT CONDITION → WAIT OBJECT CONDITION. 3. Select the Payment Terms field for the Contact object and check for the Static Value "Net 60". 4. After the end wait section, use INSERT ACTION → SEND E-MAIL to send an e-mail using the Change in Payment Terms template. 5. After the e-mail, create a Phone Call using the details in Table 29.

Page

208

Chapter 4: Workflow Step 2: Wait Activity 1. After the phone call activity click INSERT CONDITION → WAIT FOR CONDITIONS. 2. Select the <> area and click INSERT CONDITION → WAIT ACTIVITY CONDITION. 3. Select the "Phone Call: Explain details of Change in Payment terms" in the drop-down and select "completed". 4. After the end wait, click INSERT ACTION → CREATE ACTIVITY. Add a Letter activity using the information in Table 30. Step 3: Test the Rules 1. Save and Activate the Contact Wait For Conditions Workflow. 2. Create a new contact with the e-mail address "[email protected]". 3. Save, close, and re-open the new contact. 4. Check that there are no activities in the history area. 5. Set the Contact Payment Terms to "NET 60" then save and close the contact. 6. Wait a minute, and then open the Contact again. Note the following: – –

A completed e-mail activity in the history area A Phone call Activity

NOTE: You might not see these activities if you open the Contact immediately after making the changes.

7. Open the Phone Call Activity and click Save as Completed. 8. Close the Contact. 9. Wait a minute, then open the Contact to check that the Letter Activity has been added.

Page

209

Microsoft CRM 3.0 Customization

Demonstration: Wait for Timer Conditions This demonstration will show you how a set of workflow rule using wait for timer conditions enforce a business process.

Scenario The Sales manager at Adventure Works Cycle has a strict policy that no sales opportunity should be open for more than one month from the time it was created. He feels that this should be more than adequate time to close the deal. If the opportunity is still open after one month, it is automatically closed with a status of "Time Expired". Sales people will receive an e-mail reminder 5 days before the Opportunity is due to expire. If a sales representative wishes to continue to pursue an opportunity with the same account, they need to open a new opportunity. He also feels that any Sales opportunity that has not been updated in over 10 days is being neglected. He wants to be alerted when this happens so that he can consider re-assigning the Opportunity to another Sales representative. Workflow is used to control these policies

Goal The goal of this demonstration is to show the end result of Lab 4.6 Wait for Timer Conditions on page 211.

Steps 1. Activate the three workflow rules that enforce this policy: – – –

Set Deadline Set Reminder Neglected Opportunities.

2. Open Microsoft CRM and create a new Opportunity. 3. Enter the required fields, save and close the opportunity. 4. Wait a few minutes and refresh the Opportunities view. You should see the Est. Close date being set. 5. Wait over three minutes and go to the "Closed Opportunities" View. You should find the Opportunity you created there. 6. Open the Opportunity. You should see three activities in the history area. – – –

Page

210

The Neglected Opportunities e-mail Activity The Deadline Approaching e-mail Activity The Opportunity Close Activity

Chapter 4: Workflow

Lab 4.6 Wait for Timer Conditions Scenario See the Scenario in Demonstration: Wait for Timer Conditions on page 210.

Goal Description This policy requires the creation of a new Opportunity.statuscode attribute picklist value: "Time Expired." Three separate Workflow Rules are used to enforce this policy. •

Set Deadline



Set Reminder



Neglected Opportunities

Set Deadline When opportunity is created Add DateTime: Deadline Update: Opportunity. Est. Close Date = Deadline Wait for 5 min(s) if Opportunity.Status = Open then Update: Opportunity.Status Reason = Time Expired Change state to: Lost end if FIGURE 6 - SET DEADLINE WORKFLOW

Set Reminder When opportunity is created Wait for 1 min(s) before Opportunity.Est. Close Date E-Mail To:[owner]; Subject:Deadline Approaching FIGURE 7 - SET REMINDER WORKFLOW

Page

211

Microsoft CRM 3.0 Customization The Set Reminder rule uses an email configured using the information in Table 31. To:

[owner]

Subject

Deadline Approaching

Description: In 5 days the deadline for opportunity {!Opportunity:Topic;} with {!Account:Account Name; Contact:Full Name} will be reached. At that time this opportunity will be closed as "Time Expired". TABLE 31 - REMINDER E-MAIL

Neglected Opportunities When opportunity is created Wait for 1 min(s) after Opportunity.Modified On E-Mail To:[owner’s manager]; Subject: Neglected Opportunity FIGURE 8 - NEGLECTED OPPORTUNITIES WORKFLOW

The Neglected Opportunities Rule uses an e-mail configured using the information in Table 32. To:

[owner’s manager]

Cc:

[owner];

Subject

Neglected Opportunity

Description: The Opportunity {!Opportunity:Topic;} with {!Account:Account Name; Contact:Full Name} has not been modified in 10 days. It is considered a Neglected Opportunity and is subject to re-assignment. TABLE 32 - NEGLECTED OPPORTUNITIES REMINDER

Instructions Challenge Yourself (Level 3) Use the information in the Goal Description to complete the following steps. 1. Add the "Time Expired" Status 2. Set Deadline 3. Set Reminder 4. Neglected Opportunities 5. Test the rules

Page

212

Chapter 4: Workflow Need a Little Help (Level 2) Step 1: Add the "Time Expired" Status 1. Go to SETTINGS → CUSTOMIZATION → CUSTOMIZE ENTITIES. 2. Open the Opportunity Object and select Attributes. 3. Open the statuscode attribute. 4. Select Lost from the State drop-down. 5. Click Add and enter the label "Time Expired" as a new list value. 6. Save and close the statuscode attribute. 7. Publish the Opportunity attribute. 8. Close an open Opportunity with a status of "Lost" to confirm that the Time Expired option is available. NOTE: If Workflow manager was open before you added this value, you must close and re-open Workflow manager to use this new value in a workflow rule. The metadata is cached in Workflow manager when it is opened. It is not refreshed while it is open.

Step 2: Set Deadline 1. Create a new workflow rule called "Set Deadline" on the Opportunity Create event. 2. Click INSERT ACTION→CALL ASSEMBLY→DATE TIME FUNCTIONS→ADD DATETIME. a. Enter Action Name of "Deadline" b. Set the Date Time parameter = Opportunity.Created ON c. Set the Minutes parameter = 3. 3. Click INSERT ACTION→UPDATE OBJECT. 4. Set the Est. Close Date to the Dynamic Deadline value. 5. Click INSERT CONDITION → WAIT FOR TIMER 6. Set the Time based Wait for 3 minutes from now on. 7. Click INSERT CONDITION → CHECK CONDITIONS 8. Select the <> area and click INSERT CONDITION →CHECK OBJECT CONDITIONS. 9. Select the Opportunity Status = static value of "Open".

Page

213

Microsoft CRM 3.0 Customization 10. Select the <> area and INSERT ACTION→UPDATE OBJECT. 11. Set the Opportunity Status Reason = static value of "Time Expired". NOTE: If you don’t see the Time expired value, check that you completed Step 1 and re-opened Workflow Manager.

12. Select the Update: Opportunity.Status Reason = Time Expired item you just created and click INSERT ACTION→CHANGE STATUS. 13. Change the Status to "Lost". 14. Save the Set Deadline Workflow Rule. Step 3: Set the Reminder 1. Create a new workflow rule called "Set Reminder" on the Opportunity Create event. 2. Click INSERT CONDITION → WAIT FOR TIMER. a. Click Before and check Reevaluate expression when field is updated b. Set the field to the Object.Est.Close Date. c. Set the time to 2 minutes. 3. Click INSERT ACTION → SEND E-MAIL. 4. Enter the information in Table 31. 5. Save the Set Reminder Workflow Rule. Step 4: Neglected Opportunities 1. Create a new workflow rule called "Neglected Opportunities" on the Opportunity Create event. 2. Click INSERT CONDITION → WAIT FOR TIMER. a. Select "After" and check Reevaluate Expression when field is updated. b. Select Opportunity.Modified On. c. Select wait for 1 Minute.

Page

214

Chapter 4: Workflow 3. Click INSERT ACTION →SEND EMAIL 4. Enter the information in Table 32. 5. Save the Neglected Opportunities Workflow rule.

Step 5: Test the Rules 1. Activate the three workflow rules you created. 2. Open Microsoft CRM and create a new Opportunity. 3. Enter the required fields, save and close the opportunity. 4. Wait a few minutes and refresh the Opportunities view. You should see the Est. Close date being set. 5. Wait over three minutes and go to the "Closed Opportunities" View. You should find the Opportunity you created there. 6. Open the Opportunity. You should see three activities in the history area. – – –

The Neglected Opportunities e-mail Activity The Deadline Approaching e-mail Activity The Opportunity Close Activity

Sales Processes Sales Process Overview The process of selling a product or service can vary greatly among industries and even organizations within the same industry. Even within an organization, the processes might be different depending on the product line, different types of customers, and the methods defined by individual sales managers.

Sales Process stages A Sales Process is an effort to manage the closing of sales. A Sales Process establishes a set of stages that categorize all the open sales opportunities. Each stage is associated with a probability that the opportunity will reach a successful conclusion. Each stage also includes a minimum number of activities which must be concluded before the next stage can be reached.

Sales Process goals Sales Processes are put in place for a number of reasons. These reasons include: •

To assist a Sales manager to forecast future sales.



To provide guidance to sales people so that they consistently apply the most effective methods.



To help ensure that all legal requirements are met.

Page

215

Microsoft CRM 3.0 Customization •

To allow sales people and managers to recognize which opportunities represent the best opportunities in order to achieve the maximum amount of revenue.

When to use Sales Processes Sales Processes are commonly used when there is a lengthy or complex sales cycle. Using a Sales Process when the sales cycle is short or simple usually adds too many steps to the process.

Sales Processes in Microsoft CRM In Microsoft CRM, Sales Processes are implemented as a special type of workflow. They include most of the actions found in workflow as well as the ability to define stages. The conditions available in Sales Processes are limited to: •

Checking the status of activities created by the Sales Process.



Checking the values of related objects in order to exit the Sales Process.

Ending a Sales Process Sales Processes represent a path to the successful completion of the sale. At any time, the user can close the sales opportunity as a win or a loss, and the Sales Process ends.

Sales Processes and activities When a Sales Process is applied to a Sales Opportunity, the sales stage and all the activities associated with that stage are visible on the opportunity form. The Sales Process then waits until all the activities are complete before moving on to the next stage and assigning the next set of activities to the sales person. Change Stage Users have the capability to advance to a further stage and be assigned the set of activities for that stage. When this is done, the Sales Process continues to advance automatically. However, users also have the ability to select an earlier sales stage. Performing this action causes the automation to stop, and advancing to the next stage, becomes a manual process.

Procedure: Create a Sales Process 1. In Workflow Manager, choose Opportunity from the Entity list, and choose Sales process from the View list. 2. On the File menu, choose New. 3. In the Create a Sales Process form, you must enter a Rule name for the sales process.

Page

216

Chapter 4: Workflow 4. Enter any other information you have for this sales process. The Entity Type box is automatically populated based on the entity you selected in step 1. 5. Click Next. 6. To create your sales process behavior, select either: •

Insert Stage A. In the Sales Stage form, enter a name in the Sales stage box, enter a description in the Description box, and enter a number from 0 to 100 inclusive in the Probability box. Click OK to display the following code block in the code pane:

When Opportunity is created stage: < name >, close probability = < number > << add actions here >> wait << add conditions here >> end stage

B: Select << add actions here >> and click either: –

Insert Stage a. In the Sales Stage form, enter a name in the Sales stage box, enter a description in the Description box, and enter a number from 0 to 100 inclusive in the Probability box and click OK. b. Insert additional stages as needed.



Insert Action a. Select Create activity from the menu. You must select Create activity even though the other menu choices are enabled. Complete the Create Activity dialog box and click OK. b. Insert additional actions as needed.



Insert Condition A. The following Insert Condition code block is added:

When Opportunity is created if << add conditions here >> then exit end if

Page

217

Microsoft CRM 3.0 Customization With the Event block selected in the above code block, subsequent clicks of Insert Condition adds the following code block after the last exit in the code at the time of the click: else if << add conditions here >> then exit

B. For all << add conditions here >>, select << add conditions here >>, click Insert Condition, and complete the Check Condition form. C. Insert additional conditions as needed. 6. When you have finished creating your sales process, click Save. 7. Click Activate to be able to run your new sales process.

Demonstration: Adventure Works Cycle Sales process This demonstration will introduce a basic sales process.

Goal The goal of this demonstration is to understand Sales Process Logic and see how they work.

Steps Step 1: Review AWC Sales Process 1. Select Object Type = Opportunity and View = Sales process. 2. Select the AWC Sales Process and double click it to open it. 3. Note the logic of the Sales Process in the AWC Sales process. A

Manual Rule

B

stage: , close probability =

C D

: : wait

E

: is (either) completed (or) canceled end stage TABLE 33 - SALES PROCESS STAGE

Page

218

Chapter 4: Workflow A. Event: This is a Manual Sales process. NOTE: Sales Processes can only be based on the Create or Manual events.

B. Stage: Sales Processes are groups of stages. Each stage has a "stage..wait..end stage" structure. Each Stage is associated with a close probability. C. Activity: Activities are generated for completion during this stage. D. Action: Actions can also be included within a stage. E: Exit Criteria: With one exception, the only type of condition available in a Sales Process is the Wait Activity condition. This condition can be configured to check whether the activities created within the stage have been either completed or cancelled. NOTE: At the beginning of a Sales Process a single check Object condition may be included. If this condition is true, the Sales Process will exit.

Step 2: Test the AWC Sales Process 1. Open a new Opportunity in Microsoft CRM. 2. Fill in the required fields an save the opportunity. 3. Select ACTIONS → APPLY RULE → SELECT AWAC SALES PROCESS, click OK. 4. Click the Sales Process tab. If there is nothing there, wait a moment and click the refresh grid button. 5. Note that the Sales process stages will be presented. Note the five Open activities. 6. Open each of the tasks and save them as completed. 7. Wait a few minutes and click the refresh grid button. Note that the next six tasks become open. 9. On the Information tab for the opportunity. Note that the probability field is set to 25, corresponding to the Qualified Sponsor (D) stage. 10. Select ACTIONS → CHANGE STAGE and choose Qualified Power Sponsor (C). Click OK. 11. Wait a few minutes, click on the refresh grid button. Note that the Decision Due (B) stage has become active. The Probability of the incident is set to 75. This shows how the Qualified Power Sponsor (C) stage has been skipped.

Page

219

Microsoft CRM 3.0 Customization

Lab 4.7 Basic Sales Processes This lab requires you to create a basic sales process and test it.

Scenario Adventure Works Cycle uses a number of different Sales processes depending on different factors. One factor is the amount of Revenue. If an opportunity is for more than $50000 the Sales person is expected to use a simple sales process to associate the tasks they perform with a probability of success. This is a simple Sales process that includes 4 stages. •

Investigate



Evaluate



Negotiate



Close



Won

Investigate In this stage the Salesperson evaluates whether this opportunity represents a good investment of their time.

Evaluate In this stage the Sales person confirms that Adventure Works Cycle will be able to deliver the products for the opportunity.

Negotiate This stage represents the negotiation process.

Close This stage represents closing the deal.

Won This stage represents closing the opportunity.

Page

220

Chapter 4: Workflow Goal Description Create a manual Sales process called "Simple Sales Process". Stage: Investigate

close probability = 10

Task:

Research Account

Description:

Verify that the Account is legitimate

Task

Evaluate Competitors

Description:

Determine which competitors might be involved

Exit Criteria

Task: Research Account Complete Task: Evaluate Competitors Complete

Stage: Evaluate

close probability = 20

Task:

Check Inventory

Description

Confirm we have enough inventory to fill an order

Task

Check Open Opportunities

Description

Check if any other Opportunities could require the same inventory

Exit Criteria

Task Check Inventory Complete Task Check Open Opportunities Complete

Stage: Negotiate

close probability = 40

Task:

Submit Quote

Description

Submit a Quote for the order

Phone Call

Follow up Call

Description

Follow up on the quote. Ask for the order.

Exit Criteria

Task: Submit Quote Complete Phone Call: Follow up Call Complete

Stage: Close

close probability = 90

Task

Signed Documents

Description

Get the documents signed

Task

Update Microsoft CRM

Description

Update the Opportunity record

Exit Criteria

Task: Signed Documents Complete Task: Update Microsoft CRM Complete

Stage: Won

close probability = 100

Action

Change State to Won

TABLE 34 - BASIC SALES PROCESS

Page

221

Microsoft CRM 3.0 Customization Instructions Challenge Yourself (Level 3) Use the information in the scenario and goal description to : 1. Create a new Sales Process. 2. Configure Stages. 3. Configure Tasks/Actions. 4. Configure Exit Criteria. 5. Test the Sales Process.

Need a Little Help (Level 2) Step 1: Create a new Sales Process 1. In Workflow Manager, select Object Type = Opportunity. 2. Select View = Sales Process. 3.

Select FILE → NEW

4. Enter a Rule Name "Simple Sales Process". Step 2: Configure Stages For each of the Sale Stages in Table 34 1. Click Insert Stage. 2. Enter the Name of the Sales Stage and the probability. 3. Click OK. Step 3: Configure Tasks/Actions 1. For each of the tasks or actions in Table 34: a. Select the <> area of the stage. b. Click INSERT ACTION → CREATE ACTIVITY. c. Enter the appropriate type, subject, and description. d. Click Create Activity. 2. For the Final Stage "Won" select the <> area and select INSERT ACTION → CHANGE STATUS. 3. Select the status "Won" and click OK.

Page

222

Chapter 4: Workflow Step 4: Configure Stage Exit Criteria 1. For each Stage except the final one: a. Select the <> area and click Insert Condition. b. Select one of the corresponding Tasks/Actions for the stage and select "Completed" from the drop-down. c. Click OK. d. Repeat for all available Tasks/Actions in the stage.

NOTE: Don’t select tasks or actions from earlier stages

2. In the final stage, "Won" there is no need to include any conditions. Step 5: Test the sales process 1. Activate the Simple Sales Process you created. 2. Open a new Sales Opportunity, enter the required fields and save. 3. Select ACTIONS → APPLY RULE. 4. Select the Simple Sales Process and click OK. 5. Click the Sales Process tab and confirm that each stage and the corresponding Tasks appear. NOTE: You may need to wait a moment for the Sales process to appear. Click the refresh grid button to view the items.

6. Open each Task in order and click Save as Completed. NOTE: At the end of each stage you may need to wait a moment for the next set of tasks to open. Click the refresh grid button to view the items

7. Note that when you complete the last task the Opportunity will close with a Status of "Won".

Page

223

Microsoft CRM 3.0 Customization

Organizing Workflow Planning how you organize workflow does the following: •

Makes it easier for users to use workflow



Makes workflows easier to maintain



Reduces the risk of performance problems

Make it easier for users to use workflow Many workflows rules and Sales Processes are activated automatically based on events. However, users have the ability to manually apply workflows through the application.

Naming conventions A clear and unambiguous name helps users understand exactly what to expect when they manually execute a workflow. Manual Workflows Consider using a naming convention that helps users identify workflows they should apply manually. All workflows, regardless of the event, are available for users to apply. Users can manually apply workflows that are defined for Manual, Assign, Create and Change Status events. This means that an uninformed user could apply a workflow that is only intended to apply for a specific event. It is important that it be possible to manually apply these workflow rules in the event the workflow fails on the event. However, you do not want users to apply them inappropriately. Currently, there is no way to limit the rights of users to apply these workflow rules. You can use a naming convention to communicate to users any rules that they should not manually apply. One recommendation is to prefix the name of rules with "ADMIN ONLY...".or any other type of standard convention that users can be trained not to use without approval. NOTE: If this is a concern, you might consider including a subprocess that will evaluate some of the criteria of the object and notify the CRM administrator via e-mail if the circumstances are unexpected.

Sort order Remember that workflow rules are displayed in alphabetical order. Beginning the workflows that you want users to apply with a symbol character (like an exclamation point "!") ensure that these workflows are always displayed at the top of the list.

Page

224

Chapter 4: Workflow Make workflows easier to maintain Use SubProcesses You will want to avoid having to make changes to many workflows. Remember that you can use subprocesses to invoke frequently performed tasks. By using subprocess, you improve re-use of the workflow logic so that you only need to make changes one time to apply across many different workflows. Use Templates Workflow rules and Sales Processes can be saved as templates so that a new rule can be created that has an advanced starting point. A Template is essentially a workflow rule that cannot be activated. A new rule can be created from a template by right-clicking on it and selecting "Create rule from template".

Reduce the risk of performance problems There is a risk that a workflow can include recursive logic that can cause an infinite loop. If a loop occurs, it can quickly create a large number of instances of the workflow in memory and have an immediate negative impact on the performance of the server.

Avoiding infinite loops The best way to avoid loops is to carefully review the logic of the workflow to make sure that it does not call itself directly or through a subprocess in an uncontrolled way.. You should also test your workflows and monitor their performance, preferably in a test environment. NOTE: See Managing Workflows: on p.225 for more information on monitoring workflows.

Recovering from Infinite loops If you do experience an infinite loop and can identify which rule is causing it, immediately deactivate the rule using Workflow Manager.

Managing Workflows Terminology Knowing the correct terminology helps you understand how workflow works. Term

Description

Workflow Process

A workflow rule that has been activated and is applied to an Entity.

A running workflow process attached to a bound object. Workflow Process Instance Bound Object

An instance of an entity associated with a workflow process instance.

TABLE 35 - WORKFLOW TERMINOLOGY

Page

225

Microsoft CRM 3.0 Customization Workflow Monitor The Microsoft CRM Workflow Monitor is used to view workflow logs and manage Workflow and Sales Process rules. The Workflow monitor has two tabs: •

Process



Log

Process Tab The Process tab shows all the currently running workflow process instances. You can view a summary of all workflow process instances or filter them by bound object type. You can also filter by the status of the workflow process instance. Once a workflow process is completed, it is not displayed on the Process tab.

Log Tab The Log tab shows a history of all workflow process instances, including any workflow process instances that are running.

Actions on running processes On the Process tab, you can locate workflow process instances and perform the following actions: •

Pause



Resume



Abort



View properties

Pause Pause temporarily stops a running workflow process instance. If part of a workflow process instance experiences a failure, the workflow process instance is set to a status of paused.

Resume Whether a workflow process instance was manually paused or paused due to an error, you can resume the workflow.

Abort Abort terminates the workflow process instance.

View Properties View Properties displays Rule and Process information about the running workflow process instance. The action within a rule that is currently being performed is highlighted.

Page

226

Chapter 4: Workflow

NOTE: The information presented in the Process Properties form is not constantly refreshed. The minimum automatic refresh period is 30 seconds. You can manually refresh the screen by pressing the Refresh button (ALT+R). Pressing F5 does not refresh this screen.

Depending on the status of the workflow process instance, you can perform two additional actions: •

Retry



Jump

Retry Retry attempts to perform an action that has caused the workflow process instance to stop. You might use this if you have repaired a failing subprocess that had been causing the workflow process instance to become paused. Jump In a Sales Process, Jump allows you to manually skip to another future stage in the Sales Process. When using this action you will be warned that unexpected behavior might occur if you manually change the process step. This action is the same as a user manually changing the stage through the application. See Change Stage on p.216.

Reviewing the Log In the Log tab, you can review every workflow process instance that has been run. Each entry in the log can be opened to provide more details about the actions performed, when they were performed, and the status of the action.

Log actions There are two actions you can perform on log records: •

Purge Log



Export Log

NOTE: You must select the log entries you want to have the actions performed on. If you need to take action on a large number of entries, you can change the settings to show more entries per page.

Purge log Purge log simply deletes items from the log. You might want to periodically delete older items from the log. Export log Log items might also be exported as an XML file. You might want to export log entries to maintain a record before purging them. The XML files can also be opened in Excel and other applications if you want to perform an analysis.

Page

227

Microsoft CRM 3.0 Customization

Demonstration: Using Workflow Monitor This demonstration will show how Workflow Monitor can be used to manage workflow.

Scenario When testing and troubleshooting workflows you need to be able to see the status of any currently running workflow process instances.

Goal This demonstration will show how Workflow Monitor allows you to view the status of workflow process instances and how to perform actions on them.

Steps Step 1: Open Workflow Monitor 1. Select START→ALL PROGRAMS→MICROSOFT CRM→WORKFLOW MONITOR. 2. Confirm that the target Microsoft CRM Server is indicated and Click OK.

Step 2: View currently running Processes NOTE: The Default view when you open Workflow Manager is to show you a summary of all the currently active Workflow Process instances.

1. Select View = All. 2. Select the name of the entity you want to view from the Type dropdown list. 3. Select View = Paused to see any workflow process instances that have not been able to complete.

Step 3: View Process Properties 1. Apply one of the workflow rules you created in an earlier lab or demo to a new record in Microsoft CRM. A workflow rule with a wait condition will work best. 2. Return to Workflow monitor and observe the Workflow Process instance that appears. NOTE: You may have to wait a moment before it appears. Press F5 to refresh the List.

Page

228

Chapter 4: Workflow 3. Double-click the Workflow Process instance in the Process tab. If the logic of the workflow contains a wait condition, you will see a yellow bar indicating the current status of the rule. 4. In Microsoft CRM, perform whatever action will allow the workflow to proceed and quickly return to the Workflow Process Properties. NOTE: You may notice the latency between the time the event occurs and the results are visible in the Workflow instance Process Properties.

5. If the yellow bar hasn’t moved, click the refresh button.

Step 4: Apply actions to workflow process instances From the Process tab, right click a workflow rule with a status of waiting and select "Abort".

Step 5: View history of completed Workflow Process instances 1.

Click the Process tab and locate the workflow process instance that was aborted in step 4.

Hint: Use the View selection to choose the "Aborted" view.

2. Double click the rule to see a log of actions performed in the Workflow, when they were performed, and what the status was.

Step 6: Purge or Export the Log 1. Select one or more rows in the Log tab view using the Finished View. 2. Right click the rows and select Export Log. 3. Save the exported file. Open the file using Internet Explorer to see the output. NOTE: These files can also be opened using Excel for analysis

4. Right click the row(s) and select Purge Log. The rows will disappear from the Log tab.

Page

229

Microsoft CRM 3.0 Customization

Importing and Exporting Workflow Rules You can import and export workflow rules from one implementation to another. This allows for archiving and re-use of workflow rules that have been developed.

Exporting Workflow rules After workflow rules have been developed using Workflow Manager, they can be exported. Using the Export Workflow Wizard, you can choose which rules you want to export. The export process produces an XML definition of the rule or group of rules.

Procedure: Accessing Workflow Export Wizard <steps from help>

Procedure: Exporting Workflow Rules

Importing Workflow rules Once a rule has been exported, the XML file that defines the rule can be imported using the Import Workflow Wizard. If a group of rules is included in the XML file, you can choose which rules you want to import.

Validation Process The Import process will check the rules being imported. This process looks for dependencies within the workflow rules. If any are found, you will be notified. If the rule depends on fields that are missing on the target server, the validation will fail and you will not be able to import the rule. If the rule has dependencies that can be repaired within the workflow, you can still import the workflows, but you will need to make changes to them in order for them to work properly. The workflows and actions within the workflows will be marked with "MISSING DETAILS". Three cases where you can expect to see validation errors: •

Sub Processes



Email templates

Sub Processes If you are importing workflows that include and have a dependency on a sub process, you will need to re-establish the call to the sub process. If you intentionally create a looping workflow, by calling itself as a subprocess, you will need to edit the workflow to re-establish the call to itself. Email templates If you use an e-mail template in an e-mail action within a workflow, you will need to re-establish a connection to the template even if it already exists in the deployment.

Page

230

Chapter 4: Workflow Procedure: Accessing Workflow Import Wizard <steps from help>

Procedure: Importing Workflow Rules

Demonstration: Importing Workflow Rules This demonstration illustrates how workflow rules can be imported

Scenario Adventure Works Cycle will import a set of business rules to enforce their policy for contracts on service cases and service level agreement compliance.

Goal To leverage workflows created in another deployment in the current deployment.

Steps Step 1: Import the Workflows 1. Go to START→ALL PROGRAMS→MICROSOFT CRM→ WORKFLOW IMPORT. 2. At the Welcome screen, click Next. 3. Enter the name of the Target Server and click Next. NOTE: In the classroom for Course ####, enter "crm".

3. In the Select Source File Screen, click Browse and locate the file to import and click Next. NOTE: In the classroom for course ####, go to C:\Customization\Ch4\Case Rules.xml

5. Select both of the rules and click Next. 6. Review the XML File Validation information.

Page

231

Microsoft CRM 3.0 Customization

Microsoft CRM server : crm Number of workflow rules: 2. Source file: C:\Customization\CH4\Case Rules.xml. Need Changes (Total: 2) The following rules need changes to some parts after the Import Workflow Wizard is finished. For more information, see the Readme. Rule Name : Case Process Action E-mail Template:Case Escalation has unresolved objects. Action Exec: Check for Contract has unresolved objects. Rule Name : Check for Contract Action Exec: Check for Contract has unresolved objects. *********************

NOTE: You can copy the information describing any unresolved objects

7. Click Import

Step 2: Repair Missing Details 1. Open Workflow Manager: START→ALL PROGRAMS→MICROSOFT CRMÆWORKFLOW MANAGER. 2. Connect to the CRM server and select "Case" as the object type. 3. Note that the name of both workflows has been appended with "MISSING DETAILS". 4. Open the Check for Contract workflow. 5. Remove the text "MISSING DETAILS" from the Rule Name . 6. Save the Rule and re-open the rule. 7. Select the action "MISSING DETAILS Exec: Check for Contract" and choose "Edit Selected". 8. Re apply the Check for Contract Rule to the Sub process action and Save the rule. 9. Open the "MISSING DETAILS Case Process" rule. 10. Remove the text "MISSING DETAILS" from the Rule Name .

Page

232

Chapter 4: Workflow 11. Select the "MISSING DETAILS Exec: Check for Contract" action and reapply the "Check for Contract" sub process. 12. Select the "MISSING DETAILS E-mail Template: Case Escalation action and reapply the Case Escalation E-mail template. 13. Save the Case Process rule.

Troubleshooting Workflows This lesson introduces some common issues with troubleshooting workflows and some issues that you can avoid.

Dependencies Workflows are reliable but are dependant on other capabilities of Microsoft CRM. If your workflows are not operating as expected, you should first confirm that you can manually reproduce the desired behavior in the application. For example, if your workflow is not sending an e-mail as you expect, try to send the same e-mail manually. The problem might be related to the ability to send e-mail rather than workflow.

Refresh Metadata If you attempt to reference a newly created entity or attribute in a workflow, you must stop and restart the Microsoft CRM Workflow service so that workflow can recognize the new entity or attribute. This refreshes the metadata used by the workflow service.

Importing data A large number of create events will occur when new objects are created during data import. This can create a burden on the server as the Workflow service responds to these events. This can also slow down the import process as well as the general performance of the server. This can be mitigated by disabling the workflow while the records are being imported. After all the objects have been created, re-activate the workflow, and use Advanced Find to look for all the new records. Apply the workflow manually.

Workflows do not respond to changes Once a workflow process instance has been started, the actions and conditions within it are set. If you modify a workflow process, any active workflow process instances defined before that change will not be affected. You need to manually stop those workflow process instances and manually reapply the workflow again for the changes to be applied.

Page

233

Microsoft CRM 3.0 Customization

Summary This chapter introduced each of the features found in Workflow and Sales Processes. You saw the available actions and conditions that can be used as well as the tools used to apply them. Creating value with workflow is the ability to translate these features into effective processes for the organization.

Importing and Exporting Workflow Rules You can import and export workflows between implementations. This allows for business processes to be created and reused many times across different implementations.

Defining Workflow Rules A workflow must be created before actions and conditions can be applied. Once it has been configured, it must be activated before it can be used.

Creating a Workflow Rule Workflow rules can be created only for the entities that support them. These include user-owned custom entities. A workflow is associated with a particular event or can be designated as a manual workflow.

Workflow Limitations Workflow does not support direct association with the update event. Several solutions were presented that allow you to take advantage of the fact that workflow listens for the update event.

Workflow Actions Workflow actions can be grouped into three categories: Activity Creation, Object Update, and Flow control. Within these groups are a number of available actions. Of all the actions, the call assembly action is the most powerful.

Dynamic Text and Values Workflow allows you to include references to other objects in the activities you create and the actions you perform in workflow.

Workflow Conditions You can control when the actions you define in workflow are applied through conditions. Conditions are grouped into three basic conditions: Check, Wait for, and Wait for timer.

Page

234

Chapter 4: Workflow Sales Processes Sales Processes are a specialized form of workflow that apply to sales opportunities. Sales Processes allow for the management of sales opportunity by categorizing them into certain stages. Each stage is associated with a probability that the sale will be closed successfully. Each stage also includes a number of activities that must be performed before the opportunity can be advanced to the next stage.

Organizing Workflow Several techniques were introduced to help organize workflow in order to: •

Make it easier for users to use workflow.



Make workflows easier to maintain.



Reduce the risk of performance problems.

Managing Workflows Workflow Monitor is the tool that allows you to manage workflow process instances. With workflow Manager, you can check on the status of running workflows and address any workflows that fail.

Troubleshooting Workflows Workflow is reliable but some consideration needs to be taken for dependencies on other capabilities. Certain actions, like importing data, can cause workflow to impact performance.

Page

235

Microsoft CRM 3.0 Customization

Test Your Knowledge Make sure the understanding of each event is clear.

Page

236

Chapter 4: Workflow

Additional Resources SDK information on creating Assembly plug ins.

Page

237

Microsoft CRM 3.0 Customization

Quick Interaction: Lessons Learned Take a moment to write down three Key Points you have learned from this chapter: 1.

2.

3.

Page

238

Related Documents

Crm30 Enus Cus 04
November 2019 7
Ax40 Enus Ins 04
June 2020 3
Orar020309 Cus
December 2019 3
Ax40 Enus Ins 03
June 2020 4
Cus Data 2
June 2020 4