Fix: workflow does not start triggered by incoming email

Scenario:
Your SharePoint designer workflow is triggered by the creation of a new item through UI but not by the receiving of an email (which also creates a new item).

Script / Fix:

stsadm -o setproperty -pn declarativeworkflowautostartonemailenabled -pv true
Note:
You can also check the state of the declarativeworkflowautostartonemailenabled flag by running this command:
stsadm -o getproperty -pn declarativeworkflowautostartonemailenabled

FIX: Coercion Failed: Unable to transform the input lookup data into the requested type.

Scenario:
When trying to set a lookup field value in a sharepoint designer workflow you get this error:
Coercion Failed: Unable to transform the input lookup data into the requested type.

Background:
In a sharepoint blog site I wanted to add the post category field to the comments list in a column called PostCategory (lookup on categories). I chose to use a workflow for this task. The workflow is triggered on item creation and update.

Here is the simple worklfow I have created:




The key is the "Return field as" field in the last dialogue box. I was getting the Coercion Failed error when setting the field type as integer. Setting it to lookup id (as integer) solved the problem.