---
schema_version: "1"
id: 08a426b9c000b69521788a4079ca5ebdf1d334029b7b2febc979bf0d36274ff1
title: Include Lists and Arrays in Payout Rules
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/sales/264-0-0/spiff_payout_rule_lists_arrays_create.md
canonical_url: https://help.salesforce.com/s/articleView?id=sales.spiff_payout_rule_lists_arrays_create.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 276f68b339ec7c0fdcb24b408c25d6fa61b85f533e612ae8058c5672c3e5615c
description: You can use list and array functions when creating payout rules in many scenarios.
products:
  - Sales Cloud
  - Sales Enablement
release: "264"
---
# Include Lists and Arrays in Payout Rules

You can use list and array functions when creating payout rules in many scenarios.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available for an additional cost in: <strong>Professional</strong> Edition with Web Services API Enabled</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d73675e76">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d73675e76 ">To create a payout rule:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d73675e76 ">
              <p>A Spiff <a href="https://help.salesforce.com/s/articleView?id=sales.spiff_users_roles_and_permissions.htm&amp;release=264.0.0&amp;type=5" title="Give users the appropriate level of access so they can be successful in Salesforce Spiff, and enforce the principle of least privilege. Assign a default role to each user, or create custom roles with access to specific Spiff functionality.">user role</a> with this permission turned on.</p>
              <p style="margin-bottom:0;">Designer Configuration: Manage</p>
            </td>

          </tr>
        </tbody>
      </table>

## Count the Number of Users on a Team

In this scenario, the payout rule counts how many members are in a team. Use the `members()` function to return a list of all members for a specified team and use the `count()` function to count the members.

1. Create a datasheet field named NumberOfTeamMembers, and add the `members()` function to it.
    
    Because you're counting the number of members, you don’t need data for specific user attributes, so you can use the list output of the function.
    
    ```
    =members("AE - North America")
    ```
2. Add the `count()` function.
    
    ```
    =count(members("AE - North America"))
    ```
    
    ![Count function for the number of members in a team](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-sales-sales_performance_management-264-0-0-production-enus/b1f2feb4-26b8-444f-97f7-be2349869d93/sales_performance_management/images/spiff/spiff_payout_rule_number_of_team_members.png)

You can include this datasheet field in other calculations, showit on your rep statements, or keep it in the Payout Rule for admins to see as reference.

## Sum Quotas for Members of a Team

In this scenario, the team lead’s quota is the sum of the quotas for all of their team members. Use the `members()` function to return a list of all members for a specified team, use the `quotas()` function to return the quotas of the members, and then sum the quotas for all members.

1. Create a worksheet calculation TeamMembersQuotaSum, and add the `members()` function to it.
    
    Use a worksheet calculation because you're totaling team member quotas, but not calculating each deal.
    
    ```
    =members("AE - North America")
    ```
2. Add the `quotas()` function.
    
    The first argument is a user or a list of users that the `members()` function returned. The second argument is the quota name. Then add a date range, such as the current statement period.
    
    ```
    =quotas(members("AE - North America", "QuaterlyQuota", statement_period_start_date, astatement_period_end_date)
    ```
    
    The `quotas()` function returns a list of Quota objects.
3. Add the `tranform_list()` function, which transforms the list into an array that shows only one specific attribute, quota amount, from each record in the list.
    
    ```
    =transform_list(quotas(members("AE - North America", "QuaterlyQuota", statement_period_start_date, astatement_period_end_date), amount)
    ```
4. Enclose the entire formula with the `sum()` function and update the Display Format to Currency.
    
    ```
    =sum(transform_list(quotas(members("AE - North America", "QuaterlyQuota", statement_period_start_date, astatement_period_end_date), amount))
    ```
    
    ![Sum quotas in a team](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-sales-sales_performance_management-264-0-0-production-enus/b1f2feb4-26b8-444f-97f7-be2349869d93/sales_performance_management/images/spiff/spiff_payout_rule_quotas_sum.png)

## Identify the Products in One Deal

In this scenario, the payout rule identifies the different products included in each deal. Use a one-to-many relationship between the Opportunity object and the Opportunity Product object. The Opportunity object is like a list of all your deals, and the Opportunity Product object is like a list of every product sold with each deal. To connect these objects, match the OpportunityId on the Opportunity object with the OpportunityId on the Opportunity Product object.

1. Create a one-to-many relationship OpportunityToOpportunityProducts between an Opportunity object and an Opportunity Product object.
    
    ![Opportunity to Opportunity Products relationship](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-sales-sales_performance_management-264-0-0-production-enus/b1f2feb4-26b8-444f-97f7-be2349869d93/sales_performance_management/images/spiff/spiff_payout_rule_relationship.png)
2. Create a datasheet field named ProductsOnDeals and add the relationship to the formula.
    
    This field returns a list with the label SyncedRecord for every opportunity product record that's returned for each deal.
3. Add the `transform_list()` function, which transforms the list into an array and shows the name of each product included in a deal.
    
    ```
    =transform_list(OpportunityToOpportunityProducts, Name)
    ```
    
    ![Array for multiple products in one deal](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-sales-sales_performance_management-264-0-0-production-enus/b1f2feb4-26b8-444f-97f7-be2349869d93/sales_performance_management/images/spiff/spiff_payout_rule_relationship_product_in_deal.png)
    
    Some rows in the array return empty brackets, which means thatno products are included in the deal.

## Combine Members of Two Teams

In this scenario, two teams have the same team lead and the payout rule builds a list of all members under the team lead. Turn an array of team members from a single team into a comma-separated string, combine the string with other comma-separated strings of user names, and turn the string back into an array.

1. Convert your lists into comma-separated strings.
    
    ```
    AE_EMEA = transform_list(users_in_team(team("AE-EMEA"),statement_period_start_date, astatement_period_end_date), concat([name,","]))
    AE_NA = transform_list(users_in_team(team("AE-NorthAmerica"),statement_period_start_date, astatement_period_end_date), concat([name,","]))
    ```
2. Add the `concat()` function, which combines the comma-separated strings of the two calculations.
    
    ![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-sales-sales_performance_management-264-0-0-production-enus/b1f2feb4-26b8-444f-97f7-be2349869d93/images/icon_tip.png)
    
    Tip You can see the entire comma-separated list when hovering over the worksheet cell.
    
    ```
    AE_Team_Members = concat([AE_EMEA,AE_NA])
    ```
3. Add the `text_to_list()` function, which transforms the comma-separated string into an array, All\_AETeam\_Members.
    
    ```
    All_AETeam_Members = text_to_list(AE_Team_Members,",")
    ```
    
    ![Array of combined members of teams](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-sales-sales_performance_management-264-0-0-production-enus/b1f2feb4-26b8-444f-97f7-be2349869d93/sales_performance_management/images/spiff/spiff_payout_rule_all_team_members.png)

#### See Also

- [Set Up a Data Relationship in Salesforce Spiff](https://help.salesforce.com/s/articleView?id=sales.spiff_relationship_create.htm&release=264.0.0&type=5 "To set up a relationship between two object data tables in Salesforce Spiff, select a field with a common value for both objects.")
- [count](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_count.htm&release=264.0.0&type=5 "Returns the total number of items in a list or data filter in Salesforce Spiff.")
- [members](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_members.htm&release=264.0.0&type=5 "Returns a list of user objects for users who belong to one or more teams in Salesforce Spiff, based on a specific date range and levels of team hierarchy. Optionally return both managers and team members or team members only. To return managers only, use the managers() function.")
- [quotas](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_quotas.htm&release=264.0.0&type=5 "Returns a list of quota values from a quota table in Salesforce Spiff. The quota values are for a specific user in a specific time period.")