Creating and managing workflows
Workflows, along with the newly introduced concept of dialogs have all been grouped as Process in Dynamics CRM 2011. The workflow concept remains similar to that of previous versions, with some additional functionality.
Getting ready
We will be adding a very basic workflow to our existing solution package. Open the already created solution package to work with.
How to do it...
In order to add a new workflow using the wizard, perform the following steps:
- In the solution package, navigate to Processes and open the Processes view.
- Click on New to create a new workflow.
- On the Process: New page, give the new workflow a name, select an entity it will work against, and from the Category drop-down, select Workflow.
- Leave default the selection for New blank process, and click on the OK button.
- The process wizard starts, and it allows us to configure the workflow properties and parameters.
- In the Options for Automatic Processes section, I will select the scope to be Organization, and the start to be generated by the Record is created event.
- Next, we will add a simple e-mail notification step to be executed. Click on Add Step, and select Send E-mail. This will add the Send e-mail step, and allows us to configure the properties.
- Click on Set Properties, and start customizing the e-mail properties. We can add the From to be the current user that creates the record, and the To field to be the owner of the record. Also, we can create a subject and body.
- Click on Save and Close to complete the message configuration.
- Additionally, you can define a step description in the workflow step wizard window.
- With our step created and configured properly, now we can save the workflow. Click on Save. In order to enable this workflow, we have to activate it. Click next on Activate.
- Click OK on the Process Activation Confirmation window. If there is no error in the workflow, it will become active.
- Once the workflow is activated, we can create a new record and verify that it performs as expected.
How it works...
This sample workflow we created sends an e-mail confirmation once a new Contact record is created. As long as the workflow stays active in the system, it will execute on each record creation, as configured. Other configuration options include the capture of field value changes, new assignment of record to another user, or on record deletion. The record deletion event captured can also be used to validate record deletion, and stop the process if certain conditions are not met.
See also
- For additional information on Processes, including workflows and dialogs, as well as a comparison between the two, see the TechNet articles at http://technet.microsoft.com/en-us/library/gg309471.aspx.