Views:

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.
 

North52 Decision Suite Solution

The North52 Decision Suite 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'.

North52 Decision Suite 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! 

Workflow

Email Message

N52 Process Genie


Email Sent to Team Members

Fetch-XML


Formula

SmartFlow(
  
    SetVar('TeamMembers', FindRecordsFD('retrieveTeamMembers', true, 
           SetParams([email.regardingobjectid]))),
  
  UpdateRecord('email',
               [email.activityid],
               SetAttributePartyList('to', 'systemuser', GetVar('TeamMembers'), 'systemuserid')),
  
    SendEmail([email.activityid])
  )

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}" />
            </filter>
       </link-entity>
   </entity>
</fetch>

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?

We listen to customer feedback!

Although our business rules engine for Dynamics 365 has over 500 functions, sometimes you'll come across a requirement for which we don't provide a specific function for. Let us know the details and our team will be happy to review your requirement or suggestion and either provide a solution from our existing toolset or look to enhance our product to meet your requirements. 

You can make suggestions on our ideas page or email us directly at support@north52.com