A frequently asked question is about converting an incoming email into a case (or a lead). If you open an email activity, it has actions to convert it into a case or a lead or opportunity. More commonly, there is a need to automate this process.
In this blog, I’ll give a walkthrough’ of how you can use CRM 4.0’s workflow capabilities to automatically convert emails into cases. Say you want to automatically create a case for every email sent to: support@mycompany.com
At a high level, you need to:
1) Create a queue and map it to the email address at which email messages will be received (support@mycompany.com in this example)
2) Configure the queue to automatically create email activities for incoming email.
3) Create a workflow rule on email activity create. This workflow rule will be defined to create a case based on the email activity being created.

Create/Configure a Queue

You can create a queue by going to Settings -> Business Management -> Queues. For email integration to work with Queues, it is important that email integration be setup correctly. http://blogs.msdn.com/crm/archive/2008/02/07/crm-4-0-e-mail-integration-overview.aspx has a good overview of how to do this.
In my example, I’ve named the queue ‘MyCompany Support Issues’ and configured it to automatically create email activities for all emails received at support@mycompany.com
clip_image002

Define Workflow Rule

For this blog, I want to use only the workflow UI to define the workflow rule and avoid having to use custom workflow assemblies. Here is an outline of the logic we want to execute in the workflow:
When an email activity is created
{
If the email is sent to: ‘support@mycompany.com’ then
{
Create a case. Set fields on the case based on the fields of the email activity.
Update the email activity – set the email activity as regarding the case that was created above.
}
}
Here is how to do this thru’ the workflow UI editor:
1. From settings -> Workflow, select create a new blank workflow and select the Entity as E-mail
clip_image004
2. Configure properties of the workflow – I’ve set the scope to be organization and made it available for on-demand execution. If the workflow is marked as available to run on-demand, On-demand execution makes it easy for me to test the workflow
3. Add a check condition step and configure the step. This step will check if the email was sent to the support queue.
a. Select Email from the first drop-down list.
b. The 2nd drop-down now lists all the fields available on the Email activity. You can select the To field or the To Recipients field. The To Recipients field is useful if the email is sent to multiple recipients.
c. Select the Equals operator for the 3rd drop-down
d. To set the value that the To field should equal, click on the lookup, select ‘Queue’ for the Look For drop-down and search. You should find the queue that you created.
clip_image006
e. If you decided to use the To Recipients field, simply type in the email address as shown below.
f. Save and Close the condition.
clip_image008
4. Add a create record step if the above condition is true and configure it. This step will create a case and properties of the case will be set based on the incoming email.
a. Select ‘Case’ as the entity to be created and use the ‘Set Properties’ button to configure how the case should be created.
b. For the case title, I used the workflow editor’s ‘Dynamic Values’ capability to set the title of the case to be the same as that of the incoming email activity’s subject. The online help for the workflow page has more details on how to use dynamic values.
c. Creating a case requires at least a customer and a subject to be specified. If the email is from someone who isn’t already in the system, you might want to have the workflow rule create a contact for the sender. To keep the example simple, I’ve opted to use a default contact (a contact named Test) if the sender is not recognized.
d. Save and close the create case step.
clip_image010
5. To link the email activity to the case created, add an update step on Email entity. Update the email’s regarding field to be the case that was created in the previous step.
a. On the form assistant, select ‘Create Case (Case)’ for the LookFor drop-down. The next drop down will now show the fields on the case record that are available (such as the case itself, or the customer with which the case is associated etc). Select ‘case’ for the second drop down, hit the ‘Add’ button and ‘ok’ to finish the association.
clip_image012
6. Hit the ‘Publish’ button to publish the workflow.
clip_image014
7. Test the workflow by creating an email activity. Set the To field on the email to be the queue. You should find that a case has been created for the email and the email activity is now regarding the case that has been created as shown below.
clip_image016
The above workflow is an example of a simple email to case conversion. If you have more complex conversion requirements, you might find that you might need to write a custom workflow assembly to implement your requirements.