Scenario Overview
Our business requirement is that when a user Qualifys a Lead record and an Opportunity gets created, we need to move any notes that users entered on the Lead entity across on to the Opportunity.
In our example our users have access to Leads but not Opportunities.
They will not be able to make the changes required on an Opportunity so we will execute this formula as the Admin account to allow for the specific changes to occur.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- Whenever an Opportunity with an Originating Lead is created, the formula is triggered
- The formula will first retrieve all notes related to the Lead
- Then it will change the reference guid (i.e. Move) the Note from the Lead to the Opportunity
North52 Decision Suite Steps
The following set of steps assumes you are just using the out of the box Dynamics 365 setup. But its easy to enhance if you have extra fields/requirements.
- Create a new formula of type 'Save - Perform Action'
- Set the Event field to just 'Create'
- Set the Source Entity to 'Opportunity'
- Set the Source Entity Property to 'Originating Lead'
- Under Deployment Settings , set Execute As to 'System User (Administrator)'
- Copy and paste the formula below into the formula description field and click Save
- You are ready to test
Formula
if( ContainsData([opportunity.originatingleadid]),
ForEachRecord(
FindRecords('annotation','objectid',[opportunity.originatingleadid],'*','50','true'),
UpdateRecord('annotation',
CurrentRecord('annotationid'),
SetAttributeLookup('objectid', 'opportunity', [opportunity.opportunityid]))
)
, 'NoOp')
Wizard - FindRecords
Please see below the wizard you can use to create the FindRecords() function call used in this formula.
Note to find the value for Entity Name, you need to select "Note" and for the Where attribute, select Regarding.
For the Equals Value, you will need to select Originating Lead from the Source tab.