Scenario Overview

In this scenario the requirement is to determine all the 'Sales Team' members of an Opportunity (i.e. an Access Team, new security feature in CRM 2013) & send them an email when the Opportunity reaches the 'Close' stage.

In the screenshot below we can see that the Sales Team currently has 3 members on the Opportunity.

N52 Formula Manager Solution

The Formula Manager solution works like this,

  • We create a Formula of type Process Genie on the Email entity
  • We create a Workflow to trigger on the Status change of an Opportunity
  • When the workflow is triggered it creates the Email
  • We then use a N52 Process Genie in the workflow to call the formula on the newly-created Email.
  • This Formula then uses a Fetch-XML query to retrieve the Sales Team members
  • The Sales Team members are then added to the email's To list
  • Finally the Formula sends the email 

Note: The Fetch-XML query returns both the teammembership guid and the systemuserid guid. Therefore we must tell the SetAttributePartyList function which guid we want to use by setting the last parameter to 'systemuserid'.

N52 Formula Manager Steps

The following set of steps outline how to create this Formula  

  • Create a new formula of type 'Process Genie'
  • Set the Source entity to 'Email'
  • Copy & paste the formula below into the formula canvas
  • Create a Fetch-XML query called retrieveTeamMembers
  • Copy & paste the Fetch-XML code into the query
  • Create a workflow and configure it as below.
  • Add in the Formula ShortCode and set the Primary Entity ID to the email as shown. 
  • Save and test! 


Email Message

N52 Process Genie

Email Sent to Team Members



    SetVar('TeamMembers', FindRecordsFD('retrieveTeamMembers', true, 
               SetAttributePartyList('to', 'systemuser', GetVar('TeamMembers'), 'systemuserid')),

Fetch-Xml Description

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
   <entity name="teammembership">
       <link-entity name="team" from="teamid" to="teamid" alias="ab">
            <filter type="and">
                <condition attribute="regardingobjectid" operator="eq"  value="{0}" />

Wizard - FindRecordsFD

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

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

Did you know?

North52 helps streamline complex healthcare processes

Healthcare providers are no strangers to complex processes and rules.  Patients expect efficient and seamless service. 

The North52 business rules engine helps healthcare providers implement complex rules in their Dynamics 365 systems quickly and without code. The rules are easily modified, tested and deployed as regulations and requirements change. 

Learn more about the North52 Decision Suite