You are here:
One-to-One and One-to-Many Relationships in Salesforce Spiff
When you create one-to-one or one-to-many relationships in Salesforce Spiff, you can directly reference the related object's fields in data filters or payout rules.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience |
| Available in: Enterprise, Unlimited, and Developer Editions |
| Available for an additional cost in: Professional Edition with Web Services API Enabled |
One-to-One Relationship Examples
The DealToAccount relationship specifies a one-to-one relationship from a deal to an account. In data filters or payout rules, enter DealToAccount and reference this relationship. To reference any field on the linked account record, add a period and enter the field name, such DealToAccount.ContractStartDate__c for the account's contract start date.
In another example, a company tracks products sold with a deal. The company calculates commission rates differently depending on the specific category of product sold. Create a DealToCategory relationship from the Deal object's Item__c field to the Category object's DealItem__c field. Reference the category item's value in commission calculations with the formula DealToCategory.DealItem__c.
One-to-Many Relationship Examples
In a one-to-many relationship, the target object has multiple records, rather than a single record with a field value that you can reference directly. To reference data from these fields, use a function that aggregates the values of the target object's related field.
For example, the AccountToOpportunities relationship specifies a one-to-many relationship from an account to opportunities. Use the sum() function that sums the values of the ARR field on the opportunities.
=sum(AccountToOpportunities, ARR)Add other criteria. For example, sum the values of the ARR field on only the opportunities where the deal closed within the current year.
=sum(AccountToOpportunities, CloseDate >= BeginningOfYear, ARR)Or, for an OppToLineItems relationship, filter opportunity line items by a specific product name.
=filter(OppToLineItems, Product = "Widget")For an InvoiceToInvoiceLineItems relationship, transform a list of invoice line item IDs into text strings.
=transform_list(InvoiceToInvoiceLineItems, Id)For an OppToOppProducts relationship, combine the choose(), transform_list(), and sort() functions to return the highest ARR value of all opportunity products linked to the opportunity, sorted in ascending order. Choose the last item in the list with the -1 argument.
=choose(-1, transform_list(sort(OppToOppProducts, ARR), ARR)
