Scenario Overview

In this business scenario when a user converts an Email to a Case you need to ensure that the description field (Body) from the Email is copied across without formatting to the newly created Case

This formula can be easily extended for 'Email to Lead' & 'Email to Opportunity'

N52 Formula Manager Solution

The Formula Manager solution works like this,

  • We create a formula of type 'Save - Perform Action' for the Email entity
  • This formula will be executed Server Side only when the Regarding Object ID field on the Email record is updated * 
  • It will check to see if the  related Regarding Object is of type Case (i.e. incident)
  • And if true it will update the description on the Case record with that of the Email description less any formatting.

*Note 1 :  When a user clicks the 'Email to Case' menu option the CRM platform behind the scenes creates the Case record & then updates the Regarding ID field on the Email record with a reference to the newly created case. You can verify all of this by looking at the audit trail for the Email record.

N52 Formula Manager Steps

  • Create a new formula of type 'Save - Perform Action'
  • Set the Mode to 'Server Side'
  • Set the Event to 'Update'
  • Set the Source entity to Email  
  • Set the Source Property to 'Regarding'
  • Copy & paste the formula below into the formula description field & click save      
  • You are ready to test, by creating an email & then clicking the 'Convert To Case' menu option on the Email entity


if([email.regardingobjectidtype] = 'incident',

                     SetAttribute('description', StripHtml([email.description]))

Wizard - StripHtml

Please see below the wizard you can use to create the StripHtml() function call used in this formula. 

Note that for this Input String , you will need to expand Source and click on Description


Did you know?

Automated tests in Dynamics 365 helps with documenting processes

Maintaining automated tests helps you create 'living' documentation of your Dynamics 365 systems, minimising the potenetial for frustrating rework.

Building a test validates the requirements, makes it easy to spot ambiguity and incompleteness and can catch defects before they are released. 

As requirements change, tests need to be updated to ensure they continue to validate, thus ensuring the documentation stays up to date.

Learn how TestShield helps automate testing in Dynamics 365