---
schema_version: "1"
id: dca44c81c93a71d599d34224035e7b81e432f6411921dfa634c545b601ab2d4b
title: Edit Sales Agreement Product Schedule Nodes
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/aaf_customize_dpe_revenue_metrics_definition_sa.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.aaf_customize_dpe_revenue_metrics_definition_sa.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c22e94b5544e268e95cafe40b3d4cbd59b7fbb1568b17dadb9a1055c5aa9a79a
description: To ensure that the fixed cost and variable cost of all products are included in Data Processing Engine calculations, update all nodes originating from Sales Agreement Product Schedule.
products:
  - Manufacturing
release: "264"
---
# Edit Sales Agreement Product Schedule Nodes

To ensure that the fixed cost and variable cost of all products are included in Data Processing Engine calculations, update all nodes originating from Sales Agreement Product Schedule.

### 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: 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></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="d79985e69">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d79985e69 ">To edit a DPE definition:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d79985e69 ">
              <ul>
                <li>Customize Application</li>

                <li>Modify All Data</li>

              </ul>
            </td>

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

Customizing a Data Processing Engine definition is complex. This example walks you through adding two custom fields, updating the required existing nodes for those fields, adding new nodes, and adding formulas to calculate the values of your custom fields. Finally, the values for fixed cost and total variable cost can be aggregated for all sales agreement products for a forecast period.

1. Add the custom fields from Price Book Entry as data source fields on a node.
    1. Search for and select the **Sales Agreement Product Schedule** data source node, then click **Add Related Object**.
    2. Select **Sales Agreement Product.Pricebook Entry** as the object.
    3. Click **Selected Fields** and select **Fixed Cost** and **Variable Cost**.
    4. Enter the alias for the fields as SAPSFixedCost and SAPSVariableCostPerUnit.
    5. Click **Done** and **Done**.
2. Create a formula node to calculate the total variable cost for sales agreement products.
    1. Click **New Node** and enter these details.
        
        Node Type: **Formula**
        
        Name: Compute SAPSTotalVariableCost
    2. Save your changes.
    3. For Source Node, search for and select **Sales Agreement Product Schedule**.
    4. Enter these formula details.
        
        Alias: SAPSTotalVariableCost
        
        Field Type: **Number**
        
        Length: 16
        
        Decimal Places: 2
        
        Formula: `{SAPSPlannedQuantity} * {SAPSVariableCostPerUnit}`
    5. Click **Done** and **Done**.
3. Update a join node to replace the source node with the new formula node.
    1. Search for and select **Filtered Sales Agreement Join Sales Agreement Product Schedule** and then update these details.
        
        Second Source Node: **Compute SAPSTotalVariableCost**
        
        Selected Fields: **SAPSTotalVariableCost**, **SAPSFixedCost**
    2. Click **Done** and **Done**.
4. Add the custom fields in all join nodes that follow the Filtered Sales Agreement Join Sales Agreement Product Schedule node.
    
    ![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-manufacturing-264-0-0-production-enus/71a7997a-6330-43f9-81ad-0e7c8f13997c/images/icon_tip.png)
    
    Tip To find the nodes that you need to update, you can follow the reference links provided at the bottom of a node’s detail page in the sentence “This node is referenced by # node.” Or you can search for the node name.
    
    1. Search for and select the **Valid Sales Agreement Join Upserted Account Forecast Set Partner** join node.
    2. In the First Node section, click **Selected Fields**.
    3. Add **SAPSTotalVariableCost** and **SAPSFixedCost** as fields and then click **Done**.
    4. For the following join nodes, repeat the steps to add the SAPSTotalVariableCost and SAPSFixedCost fields.
        
        - Valid Sales Agreement Within Acct Frcst Set Partner Date Range Join Active Prod
        - Valid Sales Agreement Join Account Forecast Set Partner Period Data
5. Create group and aggregate nodes to eliminate duplicates from sales agreement product schedules and calculate average fixed cost.
    1. Click **New Node** and enter these details.
        
        Node Type: **Group and Aggregate**
        
        Name: Aggregate SAPS To Eliminate Duplicates For Period
    2. Save your changes.
    3. For Source Node, search for and select **Filter Valid Period Nodes For SAPS Start Date And End Date**.
    4. Click **Selected Group Fields** and select these fields, then click **Done**.
        
        - AdvanceAccountForecastSetId
        - SAAccountId
        - SAPProductId
        - SAPSEndDate
        - SAPSPeriodId
        - SAPSStartDate
    5. In the Aggregate section, specify these details.
        
        Alias: MaxFixedCostForSAPS
        
        Function: **Max**
        
        Aggregate Field: **SAPSFixedCost**
    6. Click **Done** and **Done**.
    7. Repeat these steps to create another group and aggregate node with these details.
        
        Node Type: **Group and Aggregate**
        
        Name: Aggregate SAPS To Calculate AverageFixedCost
        
        Source Node: **Aggregate SAPS To Eliminate Duplicates For Period**
        
        Selected Group Fields:
        
        - AdvanceAccountForecastSetId
        - SAAccountId
        - SAPProductId
        - SAPSPeriodId
        
        Alias: AverageFixedCost
        
        Function: **Avg**
        
        Aggregate Field: **MaxFixedCostForSAPS**
    8. Click **Done** to save your changes.
6. Create a join node to retrieve fixed cost for aggregated sales agreement product schedules.
    1. Click **New Node** and enter these details.
        
        Node Type: **Join**
        
        Name: Fetch ComputedFixedCost For Aggregated SAPS
    2. Save your changes.
    3. For Join Type, select **Left Outer**.
    4. In the First Node section, search for and select **Aggregate SAPS Records To Remove Duplicate For Forecast Facts**.
    5. Click **Select Fields** and add all he fields, then click **Done**.
    6. In the Second Node section, search for and select **Aggregate SAPS To Calculate AverageFixedCost**.
    7. Click **Select Fields**, add **AverageFixedCost**, and rename its Alias as ComputedFixedCost. Then click **Done**.
    8. Map the following fields between the first node and second node.
        
        AdvanceAccountForecastSetId _with_ AdvanceAccountForecastSetId
        
        AccountId _with_ AccountId
        
        ProductId _with_ SAPProductId
        
        PeriodId _with_ SAPSPeriodId
    9. Click **Done** and **Done**.
7. Update formula nodes to compute the value of consolidated total variable cost of all sales agreement products for a particular forecast period.
    1. Search for and select the **Fetch Sales Price From Last Period For Calculation** formula node.
    2. Click **Add Formula** and enter these details.
        
        Alias: LastPeriodSAPSTotalVariableCost
        
        Field Type: **Number**
        
        Number Length: 16
        
        Decimal Places: 2
        
        Formula: `LASTVALUE({SAPSTotalVariableCost})`
    3. Click **Done** and **Done**.
    4. Use the reference link at the bottom of the page to open the **Determine Last Period Quantity And Revenue For SAPS Calculation** formula node.
    5. Click **Add Formula** and enter these details.
        
        Alias: FinalizedLastPeriodSAPSTotalVariableCost
        
        Field Type: **Number**
        
        Number Length: 16
        
        Decimal Places: 2
        
        Formula: `IF ({LastPeriodSAPSTotalVariableCost} == 0, {SAPSTotalVariableCost}, {LastPeriodSAPSTotalVariableCost})`
    6. Click **Done** and **Done**.
    7. Use the reference link to open the **Compute Quantity From Applicable Periods In SAPS Period Join Data** formula node.
    8. Click **Add Formula** and enter these details.
        
        Alias: ApplicableTotalCostFromSAPSStartDate
        
        Field Type: **Number**
        
        Number Length: 16
        
        Decimal Places: 2
        
        Formula: `IF ({IsValidPeriodNodeForSAPSStartDate} == 1, ( {ApplicableDaysFromSAPSStartDate} / {NumberOfDaysInCurrentSAPSSchedule} ) * {SAPSTotalVariableCost} , 0)`
    9. Click **Add Formula** again and enter these details.
        
        Alias: ApplicableTotalCostToSAPSEndDate
        
        Field Type: **Number**
        
        Number Length: 16
        
        Decimal Places: 2
        
        Formula: `IF ({IsValidPeriodNodeForSAPSEndDate} == 1, IF ({IsValidPeriodNodeForSAPSStartDate} == 0, ( {ApplicableDaysToSAPSEndDate} / {FinalizedNumberOfDaysInLastSAPSSchedule} ) * {FinalizedLastPeriodSAPSTotalVariableCost}, 0) , 0)`
    10. Click **Done** and **Done**.
    11. Use the reference link to open the **Compute Applicable Quantity And Revenue In SAPS Period Join Data** formula node.
    12. Click **Add Formula** and enter these details.
        
        Alias: ApplicableTotalVariableCost
        
        Field Type: **Number**
        
        Number Length: 16
        
        Decimal Places: 2
        
        Formula: `{ApplicableTotalCostToSAPSEndDate} + {ApplicableTotalCostFromSAPSStartDate}`
    13. Click **Done** and **Done**.
8. Aggregate the two computed values for total variable cost and fixed cost for sales agreement products for a particular forecast period.
    1. Search for and select the **Aggregate Records To Consolidate SAPS Period Join Data** group and aggregate node.
    2. Click **Add Aggregate** and enter these details.
        
        Alias: ConsolidatedTotalVariableCost
        
        Function: **Sum**
        
        Aggregate Field: **ApplicableTotalVariableCost**
    3. Click **Add Aggregate** again, and enter these details.
        
        Alias: MaxSAPSFixedCost
        
        Function: **Max**
        
        Aggregate Field: **SAPSFixedCost**
    4. Click **Done** and **Done**.
    5. Use the reference link to open the **Sales Agreement Metrics Data Join Account Forecast Set Partner Period Data** join node.
    6. In the First Node section, click **Selected Fields** and enter these details.
        
        Alias: ConsolidatedTotalVariableCost
        
        Alias: MaxSAPSFixedCost
    7. Click **Done** and **Done**.
    8. Use the reference link to open the **Compare Sales Agreement Metric Line Item Close Date With Period Range** formula node.
    9. Click **Add Formula** and enter these details.
        
        Alias: TotalVariableCostForCurrentPeriod
        
        Field Type: **Number**
        
        Number Length: 16
        
        Decimal Places: 2
        
        Formula: `IF({LeftPeriodId}=={PeriodId} , IF({SalesAgreementEffectiveDate} >= {PeriodStartDate} && {SalesAgreementEffectiveDate} <= {PeriodEndDate} , {ConsolidatedTotalVariableCost} , 0),0)`
    10. Click **Done** and **Done**.
    11. Use the reference link to open the **Aggregate SAPS Records To Remove Duplicate For Forecast Facts** node.
    12. Click **Add Aggregate** and enter these details.
        
        Alias: ComputedFixedCost
        
        Function: **Max**
        
        Aggregate Field: **MaxSAPSFixedCost**
    13. Click **Done** and **Done**.
    14. Use the reference link to open the **Aggregate Records To Consolidate SAPS Period Join Data** group and aggregate node.
    15. Click **Add Aggregate** and enter these details.
        
        Alias: ComputedTotalVariableCost
        
        Function: **Sum**
        
        Aggregate Field: **TotalVariableCostForCurrentPeriod**
    16. Click **Done** and **Done**.

Whew! That was a lot of customization. The next step is to change nodes originating from Opportunity Line Item.