Preventing Duplicate Email Signatures in Workflows in Dynamics 365

Jared Johnson, 03 May 2018

When generating emails automatically in Workflows, you often will want to include a signature. It is possible to retrieve the Email Signature entity in a Custom Workflow activity and return the HTML which can be added into the email.

While this will appear to work fine if the email is also sent in the workflow, if instead you have a process where the email is created in a draft state, and then a CRM  user will open the email and then send it to the user (perhaps to add content or to check over the email before sending), if the CRM user has a default email signature it will add another signature to the email.

This is because when CRM  adds the email signature to the email, it will enclose the email signature html in a div element with the id of signature. This is how it determines a signature has been added, and what part of the email to replace if you switch signatures.

To fix this, in the Custom Workflow activity when extracting the HTML from the Presentation XML field from the Email Signature entity, wrap the HTML in a div element with an id of signature, like in the code below.

image