Scenario Overview

In this scenario we are demonstrating how to use N52 BPA to create Template emails in CRM, and use both parameters and dynamic data slugs to populate the emails.

This will allow you to add information to emails using parameters passed like {0}, {1} etc. from within the formula and information like [], [incident.ticketnumber] from inside the template email itself.

For this example we will use a custom entity type called test1, however you can use this functionality with any entity in CRM.

The test1 entity has an N:1 relationship with the account entity.

Using the [syntax] functionality within the template you can reach across N:1 relationships and return data.
[new_test1.new_accountid.creditlimit.#] (see the notes on Syntax below) will retrieve the credit limit from the parent account connected with the test1 entity.

Global Template

North52 Decision Suite Solution

The North52 Decision Suite solution works like this:

  • Formula of type 'Save - Perform Action' is set up on the test1 entity
  • The Formula creates the email using the template name and the language code.
  • Then it sends the email out to the customer

N52 Formula

Resulting Email


         SetVar('TemplateID', FindTemplateId('Shannon Test One', '1033')),

          SetVar('EmailID', CreateEmailFromTemplate(GetVar('TemplateID'),
                    SetAttribute('subject', StringFormat([email.subject],
                                  ToString(LocalDate(), 'MMM-dd-yyyy') )), 
                                                            'Shannon', 'Mundy'  ))

Note Syntax in the Email Templates


The hash symbol value will result in a blank string being inserted into the email template if there is no existing value in the record.

The zero at end acts as the default value if none is found on the record

the _fmt will use the formatted value instead of the base value thereby inserting 'prettier' data into the 

Note Template Emails

You can pass in calculated or dynamic values created in the formula into the Template email using the {0}, {1} values etc. More static values that already exist in the CRM system can be passed into the global template email using the data slugs like [account.accountid] etc.

Reminder: When using {0} parameters for the subject or body of an email, you must include them in the StringFormat() function parameters unless you want them to fully overwrite anything in there previously
Example: Hello {0}, How are you?

SetAttribute('description', StringFormat([email.description], 'John') = "Hello John, How are you?"
SetAttribute('description', 'John') = "John"

Without the StringFormat([email.description], 'John') N52 will simply set the email description to John. Using the StringFormat([email.description], 'John') command tells N52 that you want to merge ‘John’ into the existing data in the email body at the first parameter position {0}.

Wizard - FindTemplateId

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

Note you will need to either type or paste in the following. 

Did you know?

TestShield Makes Test Automation a First Class Citizen in Dynamics 365

Test automation principles leads to improved communication, reliability and teamwork as you enhance the ever changing business processes. The team members need to roll out change requests on the existing system and build new applications making automated testing very important. 

Top 3 Benefits of Dynamics 365 Automated Testing:
  • Validated Business Processes: Dynamics 365 Automated Testing provides a robust approach to validate the business rules and process requirements of Dynamics 365 solutions
  • Better Engagement: Dynamics 365 Automated Testing ensures that end users get top-class user experience
  • Faster Delivery Time: Dynamics 365 Automated Testing assures fast delivery time by leveraging automation

The growing number of Dynamics applications that are being developed continuously presents a major challenge for Dynamics 365 testing. With such fast development, organizations need to ensure that these applications are thoroughly and constantly tested before being deployed.

Learn how TestShield helps automate testing in your Dynamics 365 projects