Workflow is one of the key features that differentiates Microsoft CRM from other solutions. Microsoft regards workflow as so important that it has built a complete framework into the operating system. This means that workflow can be integrated with almost any application running on windows.
The windows workflow foundation allows programmers to create programs that stop and start and wait for something to happen just as a business process might do. For example, checking the credit status of an applicant for a mortgage may require many sequential or simultaneous tasks to be performed. Windows workflow allows such complex processes to be modelled in software.
Microsoft CRM 4.0 uses the new workflow engine but allows you to create your own workflow using the CRM application. Workflows operate automatically when certain things change on a record and they can be specified in the settings-workflow work area of CRM.
Note: Workflow can be extended by a programmer using the Windows Workflow Foundation tools for Visual Studio 2005.
Each workflow is given a name and an entity to which it applies and it can apply to just the current user, their business unit or the whole organisation. This allows you to create workflow for just the sales department, for example. In addition, a workflow can be saved as a template to form the basis of other workflows.
16.1. Workflow Triggers
Workflows are triggered by an event happening within CRM, usually by a someone creating or altering data. The available triggers are:
· Create. The trigger fires automatically when a record is created (as the new record is saved).
· Status Change. The status values against an entity are easily customised and should reflect the relevant stage in the life history of the entity. A change in the status is a good place to create workflow actions which will vary according to each stage in the business process.
· Assign. Change of ownership (perhaps from a queue to a user) can automatically fire a workflow trigger.
· Attribute Change. Changes to particular field values in the database can automatically fire a trigger to start a business process. This could, for example, trigger a workflow when a custom checkbox is ticked.
· Delete. Automatic trigger to carry out a process when an entity occurrence is deleted.
Workflows can also be triggered on demand and are made available against the activate workflow button that appears on the actions menu when viewing a form.
Finally, a reusable child workflow can be specified which can be called from other workflows.
The lower half of the workflow pane contains the workflow process, which is specified as a series of steps. You can combine several steps into stages if you have a complex set of activities to be performed together within a single workflow.
Each step constitutes an action which may send an email, create an activity or change some data within the entity or related entity occurrences. More complex actions can, of course, be implemented by programmers.
The available action types are:
· Create Record. Create a new record usually specifying a related entity and defining data from the current record to give meaning to the new data. Activities and Notes can be created and related to the base record as well as any other entity.
· Update Record. Update the current or related entity data.
· Assign Record. Change the ownership of the current or related entity records.
· Send Email. Send an email or email template (with attachments).
· Start Child Workflow.
· Change Status. Changing the status of the current record is especially useful if you make the status field read-only so that it can only be changed automatically by workflow once all the relevant data has been specified and checked.
· Stop Workflow. Workflow is designed to pause and restart as the various processes are completed. This action indicates that the business process is complete.
The following screenshot shows the creation of a task activity during workflow triggered on the account entity.
The create record action is used and the template form for the task entity to be created is used to specify the values required for the new task record. The form assistant on the right hand side allows you to place dynamic values into the form. These values allow you to relate the newly created record to the current workflow entity occurrence.
You can see in the example that the regarding value is set to the account entity and the account name is referenced in the subject field value. This is done by positioning the cursor in the required field on the form template and then selecting the required field in the dynamic values, pressing the add button and specifying any default text (to be entered if there is no value in the required field). Pressing OK will insert the appropriate dynamic value into the form.
Note: You can add more than one dynamic field value into the list of fields, and the first one in the list with a value will be inserted or the default value used if none of the fields have a value.
Workflow conditions allow a single workflow to have a number of outcomes according to the state of the underlying data at the time the workflow is executed. The following example stops a workflow if a value has already been entered into the credit limit field of the account.
Conditions are very useful for the change status type of workflow to allow a single workflow to carry out different steps according to the current value of the entity status.
Wait conditions can be specified on workflow so that the workflow pauses and waits for a change to occur on the entity data before proceeding (this is a feature of the windows workflow framework).
Note: This may be preferable to the alternative of creating a second workflow rule on the attribute change event.
Workflow can be applied to most entities in CRM but workflow against opportunities can be used in conjunction with updating the pipeline phase and the probability values to help drive the sales pipeline reporting process.
The idea is to create a series of workflows against the opportunity entity to reflect the stages in the sales processes of the organisation. Each stage (or pipeline phase) may require a number of tasks to be carried out and successful completion leads on to the next stage in the pipeline. As each stage processes, the probability of a successful sale increases.
The workflow needs to be created against the opportunity entity and is available on demand in this case and can be activated once the opportunity has been created with the run workflow button on the opportunity form toolbar. This workflow is made available to everyone in the same business unit as the creator of the workflow.
The add step button is used to add the first stage which refers to the Customisation Enquiry pipeline phase. The insert action is used to create a task that is due in three days time and prompts the owner to try and schedule an appointment.
A second action is added to update the opportunity record and set the pipeline phase to have the value Customisation Enquiry and the probability to 5.
A second stage is added which has a wait condition that waits for the task created in the first phase to be completed and then changes the pipeline phase to Appointment Booked and the probability to 15%.
Once you have created the opportunity, the workflow can be run from the run workflow button and automatically sets the pipeline phase to Customisation Enquiry, the probability to 5% and creates the task against the opportunity. You may need to wait a little or press f5 to refresh the form for the workflow to appear in the workflow area of the navigation pane.
The workflow process shows which stages in the workflow process have been completed.
Completing the task will move the pipeline phase on to the next stage setting the probability to 15%.