Scenario Overview

In this scenario we are sending an email survey out to customers whose case's were closed the previous day. 

To do this we will use Scheduler to retrieve the cases and then Process Genie to execute a Formula that will create the Email Template and insert the survey snippet into the customer email.

The advantage here is that by inserting the snippet dynamically, you can use the same template email for multiple surveys, instead of having to create a template email for each individual survey.

Voice of the Customer Survey 


N52 Formula Manager Solution

The Formula Manager solution works like this:

  • Formula of type 'Process Genie' set up on the Case entity  
  • Workflow is set up on the Case entity**
  • Scheduler is then set up that will trigger the workflow.
  • The workflow will invoke the N52 formula via a Process Genie step.
  • The Formula creates the email using the template name and the language code.
  • It inserts the Survey Snippet into the template email.
  • Finally it sends the email out to the customer

** as this workflow is being triggered by the scheduler, it doesn't need a start condition.

N52 Formula

Workflow Setup

Template Email

Customer Email

N52 Formula Manager Steps

The following set of steps outline how to create this Formula:

  • Create the formula of type Process Genie on the Case entity 
  • Copy in the formula code below
  • Create the Scheduler and copy in the FetchXML below.
  • Create a workflow on the Case Entity entity as shown above
  • Put the formula short code into the Process Genie step
  • Click save and test


  SetVar('TemplateID', FindTemplateId('Case Survey Email', '1033')),
  SetVar('SurveyName', 'Case Closed Survey'),
  SetVar('Snip',FindValue('msdyn_survey', 'msdyn_name', GetVar('SurveyName'), 'msdyn_invitationsnippet' )),
  SetVar('EmailID', CreateEmailFromTemplate(GetVar('TemplateID'),
                    SetAttributePartyList('from', 'systemuser', [incident.ownerid]), 
              SetAttributePartyList('to', 'contact', [incident.customerid.contactid.?]),
                  SetAttributeLookup('regardingobjectid', 'incident', [incident.incidentid]),
                     SetAttribute('subject', StringFormat([email.subject], [incident.ticketnumber])), 
              SetAttribute('description', StringFormat([email.description],

Fetch XML - Scheduler

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
  <entity name="incident" >
    <attribute name="title" />
    <attribute name="ticketnumber" />
    <attribute name="createdon" />
    <attribute name="incidentid" />
    <attribute name="caseorigincode" />
    <order attribute="title" descending="false" />
    <filter type="and" >
      <condition attribute="modifiedon" operator="yesterday" />

Note 1 : Template Emails

You can pass additional information into the template by using the {0}, {1} parameters into template.

In this example, the subject line the Template is {0}. 
When this line of code executes into the Formula:
SetAttribute('subject', 'North 52 Product Information'),   

The {0} in the subject line will be replaced with the 'Bluetooth Pen - Product Information'

[email.subject] and [email.description]
If you want to replace multiple {0}, {1}, {2} values within the body or a subject bar of an email then you should use the StringFormat([email.description], 'value to be used') command.

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.