Scenario Overview

In this business 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 Individual 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 to execute whenever the Stage of an Opportunity changes
  • If the Stage is set to 'Close' then will perform our processing
  • First we will execute a Fetch-Xml query to retrieve all the Team Members for the current Opportunity
  • Next we will loop over these Users one by one calling an Action
  • The Action takes a User & the total number of recipients as parameters to generate & send the email

N52 Formula Manager Steps

Formula Steps

  • Create a new formula of type 'Save - Perform Action'
  • Set the Source entity to 'Opportunity'
  • Set the Source Property field to 'Stage'
  • Copy & paste the formula below into the formula description field & click save 


Formula Detail Steps

  • Scroll half way down the formula & click to add a new formula detail record (i.e. add the fetch-xml query)
  • Set the Name to 'RetrieveTeamMembers'
  • Copy & paste the fetchxml below into the query field & click save

Action Steps

  • Create a new Action within MS CRM
  • Set the name of the Action to 'Send Email Closing Opportunity'
  • Set the Unique Name to 'SendEmailClosingOpportunity'
  • Create an Argument called 'emailto', set the Type to EntityReference and make it required 
  • Create an Argument called 'numberofrecipients', set the Type to Integer and make it required 
  • Now add a 'Send Email' step to the Action
  • Use the 'emailto' to set the 'To' field of the email 
  • Use the 'numberofrecipientsemailto' within the description field of the email


if( FindValue('processstage',
               SetFindAnd('processid', 'processstageid'),
               SetFindAnd([opportunity.processid], [opportunity.stageid]), 'stagename') = 'close',


           FindRecordsFetchXml( StringFormat(GetFetchXml('RetrieveTeamMembers'),

                                SetAttributeActionLookup('emailto', 'EntityReference', 'systemuser', 
                                                         CurrentRecord('systemuserid') ) ,
                                SetAttributeAction('numberofrecipients', 'Integer', RecordTotal() )


<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}" />

Did you know?

You can create customized buttons to trigger complex business rules

North52's Decision Suite has functionality that we call Quick Buttons that allows you to place buttons on a form which when clicked will trigger a North52 Formula.  The business rule logic could be as simple as triggering a workflow or a much more complex process which involves many actions - the full power of the North52 business rules engine for Dynamics 365 can be used. 

The button's themselves can be subject to business rules, that show/hide, activate/deactivate or and/or change labels. This is configured using Decision Tables allowing complex decision logic to drive the button options that are presented to users.

Learn more about Quick Buttons