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?

xCache can help with advanced Case prioritization rules

Every organization has different rules for managing case prioritization, some can be very complex.  With North52's business rules engine for Microsoft Dynamics 365 you can use the xCache functionality for impelementing highly efficient case prioritization rules. 

Learn how we do it in this knowledge base article