Creating a Formula
1. Click the New icon.
2. Select a target object from the Target Object picklist.
3. Select a target field from the Target Field picklist.
4. Enter a descriptive, preferably unique name for the Formula Name and press tab to move to the next field; Formula ID is auto populated from the name, after replacing the spaces with '_'.
5. Enter a description for the formula in the Description section.
6. Configure the formula using the available target header / child items. Expand the target header / child tree item and click the field you need. For example, to select the Date function TODAY, expand the Function tree, and expand the tree item, and click the function name.
7. Copy the 'Field Value' value '$F.TODAY()' and paste it in the HTML Editor content area.
8. Click the Save button to save the formula and continue to edit.
9. Click the Add To Process button to add the formula to the SFM transaction.
Given below are some formulas that illustrate sample business use case:
Math and Rollup functions
Requirement: Calculate Work Detail Discounted Line Price (custom currency field) in sections Parts and Labor as Line Price Per Unit * Line Qty * ((100 – Discount %)/100)
Formula: $F.MULTIPLY($F.MULTIPLY($D.Parts.SVMXC__Actual_Quantity2__c, $D.Parts.SVMXC__Actual_Price2__c), $F.DIVIDE($F.SUBTRACT(100, $D.Parts.SVMXC__Discount__c), 100)) $F.MULTIPLY($F.MULTIPLY ($D.Labor.SVMXC__Actual_Quantity2__c, $D. Labor.SVMXC__Actual_Price2__c), $F.DIVIDE($F.SUBTRACT(100, $D. Labor.SVMXC__Discount__c), 100))
Roll-up the sub-totals of Work Detail Discounted Line Price in sections Parts and Labor to a Work Order field
$F.ADD($F.SUMOF($D.Parts, ‘Discounted_Line_Price__c’), $F.SUMOF($D.Labor, ‘Discounted_Line_Price__c’’))
Conditional Value and Field Mapping with Logical functions
Requirement: If Customer Down is checked, set work order's Priority to High; else leave the Priority unchanged
Formula: $F.IF($F.EQUAL($D.Work_Order.SVMXC__Customer_Down__c,'true'), 'High', $D.Work_Order.SVMXC__Priority__c)
Date and Datetime functions with Data Validation Rule
Requirement: If work detail’s Start Date Time and End Date Time are not on the same date, fail the transaction through an SFM Data Validation Rule
Formula: Start Date (custom date field in Work Detail): $F.DATEVALUE($D.Labor.SVMXC__Start_Date_and_ Time__c)End Date (custom date field in Work Detail): $F.DATEVALUE($D.Labor.SVMXC__End_Date_and_Time__c)
SFM Data Validation Rule: Start Date Not Equal End Date
For the complete list of all supported functions, their syntax, purpose, and examples, refer to Formula Functions.
The formula is listed in the 'Formulas available for the target objects of this SFM transaction' section.
The formula is listed with the associated target objects in the 'Formula added to the target objects of this SFM transaction' section.
Was this helpful?