Scenario Overview
In some situations you may need a CRM Action to return parameter and to implement the parameter values into a formula. Below is an example of how this can be be implemented.
We have a variable SaleTaxRate defined in a Process Action which can be called by multiple entities when needed. We require this to be integrated into a North52 formula to calculate the tax rate and consequent total amount for the estimated value in an Opportunity.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this:
- On save of the Opportunity record, the 'Est. Revenue' field is checked for a new or updated value
- If the value has changed, the formula is triggered
- This formula uses the function GetActionOutputParameter() to pull back the salestaxrate set by the Process Action new_SetSalesTaxRate
- This value is used to calculate the values for the 'Est. Sales Tax Amount' and the 'Est. Total Amount' which are then saved to their respective fields
North52 Action Creation Steps
For this example, a Action process will need to to be created that will store the variable saleratettax which is to be used by our formula.
The following set of steps outline how to create this
- Go to Settings > Processes
- Click New
- For Process name enter Set Sales Tax Rate
- For Category , select Action
- For Entity , select Opportunity
- Click Ok
- Open up this new process.
- Ensure that the Unique name is new_SetSalesTaxRate
- Under Hide Process Arguments , click the + sign
- For Name , enter SaleTaxRate
- For type, choose decimal
- Tick Required
- Scroll down and click Add Step > Assign Value
- Click on Set Properties
- Under Statement Label , enter SetSalesTaxRate
- Under Name choose SaleTaxRate
- Under Value enter 9
- Click Save and Close
- Click Save
- Click on Activate.
North52 Decision Suite Steps
The following set of steps outline how to create this Formula:
- Create a new formula of type Save - Perform Action
- Set the Mode to 'Server Side'
- Set the Event to 'Create & Update'
- Set the Source Entity to 'Opportunity'
- Set the Source Property to 'Est. Revenue'
- Go to the Formula editor
- Copy and paste the formula below
- Click Save
- It is now ready for testing
Formula
SmartFlow(
SetVar ( 'saletaxrate' ,
GetActionOutputParameter( ExecuteAction('new_SetSalesTaxRate',
'opportunity',
[opportunity.opportunityid]),
'SaleTaxRate',
'0')
) ,
UpdateRecord('opportunity', [opportunity.opportunityid],
SetAttribute('new_estsalestaxamount',
GetVar('saletaxrate') * [opportunity.estimatedvalue] / 100 ),
SetAttribute('new_esttotalamount',
[opportunity.estimatedvalue] +
GetVar('saletaxrate') * [opportunity.estimatedvalue] / 100 )
)
)
Wizard - ExecuteAction
Please see below the wizard you can use to create the ExecuteAction() function call used in this formula.
Note you will need to create the Action beforehand. To find the value for Record ID, you will need to go to the Sourcetab and search for "Opportunity"