Scenario Overview
In this scenario we have a custom field on the Quote entity called Admin Fee. This field must be populated whenever a Quote is created. The CRM system has a custom entity which stores all the admin fees by Account, Category and Parent Account.
We need to write a formula which will populate the Admin Fee field on the Quote during creation. If no Admin Fee is found then we need to set a default of zero.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- A formula of type 'Save to Current Record' is created so that when the Quote is created the formula executes
- The formula executes a fetch-xml query that returns the correct fee
- The formula passes in 3 dynamic parameters to the fetch-xml at runtime
North52 Decision Suite Steps
The following set of steps outline how to create this Formula
- Create a new formula of type 'Save To Current Record'
- Set the Event picklist to 'Create'
- Set the Source Entity to 'Quote'
- Set the Target Property to 'Admin Fee'
- Copy & paste the formula below into the formula
- Click save
Formula
FindValueFD('GetAdminFee',
'new_amount',
'0',
true,
SetParams([quote.customerid],
'2',
FindValue('account', 'accountid', [quote.customerid], 'parentaccountid' )
)
)
Formula Detail Steps
The following set of steps outline how to create the Formula Detail record (i.e. fetch-xml)
- Create a new formula detailed called 'GetAdminfee'
- Copy & paste the fetch-xml from below into the query field
- Click save
Fetch-XML
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> <entity name="new_adminfeelist"> <attribute name="new_name" /> <attribute name="new_amount" /> <order attribute="name" descending="false" /> <filter type="and"> <condition attribute="accountid" operator="eq" value="{0}" /> <condition attribute="categorycode" operator="eq" value="{1}" /> <condition attribute="parentaccountid" operator="eq" value="{2}" /> </filter> </entity> </fetch>
Wizard - FindValue
Please see below the wizard you can use to create the FindValue() function call used in this formula.
Note to find the value for Equals Value, you will need to go to the Source tab and search for "customer"