---
schema_version: "1"
id: ec58028916edf86c72112c47857c15b89846aa3b344d04e59c897267635ebdbb
title: Customize the MarginRangeLoader Interface Implementation
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_customize_the_marginrangeloader_interface_implementation.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_customize_the_marginrangeloader_interface_implementation.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 1751c927652378a3cac750f7c48b2040fe39fc6ce7801370340557fbbeddeac7
description: If you do not want to use a Vlocity calculation procedure to calculate your margin ranges, you can create a new one, name it in the pricing plan step, and build custom logic to load the margin range.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Customize the MarginRangeLoader Interface Implementation

If you do not want to use a Vlocity calculation procedure to calculate your margin ranges, you can create a new one, name it in the pricing plan step, and build custom logic to load the margin range.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-comms_media_energy_managed-264-0-0-production-enus/ff4079f6-a384-475c-b863-578bbbb0ef9b/images/icon_note.png)

Note

This step is optional. Skip it if you want to use Salesforce's default MarginRangeLoader interface implementation.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small " summary="Margin Range Loader Interface Implementation Properties">
        <colgroup>
          <col>
          <col>
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64887e43">
              <p style="margin-bottom:0;">Name</p>
            </th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64887e49">
              <p style="margin-bottom:0;">Properties</p>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e43 ">
              <p style="margin-bottom:0;">Interface Name</p>
            </td>

            <td data-label="Properties" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e49 ">
              <p style="margin-bottom:0;">MarginRangeLoader</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e43 ">
              <p style="margin-bottom:0;">Active Implementation Class</p>
            </td>

            <td data-label="Properties" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e49 ">
              <p style="margin-bottom:0;">DefaultMarginRangeLoaderImplementation</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e43 ">
              <p style="margin-bottom:0;">Purpose</p>
            </td>

            <td data-label="Properties" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e49 ">
              <p style="margin-bottom:0;">Introduced in the Winter '19 release, this interface
                implementation loads the margin range data from a Vlocity calculation
                procedure and returns the data in an output map. You can pass the
                calculation procedure name, loadMarginRange, through the pricing plan
                step.</p>
            </td>

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

1. Specify your input and output parameters.
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small " summary="Margin Range Loader Interface Implementation Properties">
            <colgroup>
              <col style="width:33.33333333333333%">
              <col style="width:33.33333333333333%">
              <col style="width:33.33333333333333%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64887e134">
                  <p style="margin-bottom:0;">Input /Output Data Key</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64887e140">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64887e146">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td class="slds-cell-wrap" colspan="3" style="vertical-align:top;" headers="d64887e134 d64887e140 d64887e146 ">
                  <p style="margin-bottom:0;">Input
                    Parameters</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Input /Output Data Key" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e134 ">
                  <p style="margin-bottom:0;">parent</p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e140 ">
                  <p style="margin-bottom:0;">sObject</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e146 ">
                  <p style="margin-bottom:0;">For order, opportunity, or quote</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Input /Output Data Key" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e134 ">
                  <p style="margin-bottom:0;">lineItemList</p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e140 ">
                  <p style="margin-bottom:0;">List&lt;sObject&gt;</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e146 ">
                  <p style="margin-bottom:0;">For orderItem, opportunityLineItem, or
                    quoteLineItem</p>
                </td>

              </tr>
              <tr class="">
                <td class="slds-cell-wrap" colspan="3" style="vertical-align:top;" headers="d64887e134 d64887e140 d64887e146 ">
                  <p style="margin-bottom:0;">Output
                    Parameters</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Input /Output Data Key" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e134 ">
                  <p style="margin-bottom:0;">matrix Output</p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e140 ">
                  <p style="margin-bottom:0;">Map &lt;Id, Map&lt;String, Decimal&gt;</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d64887e146 ">
                  <p>ID is lineItemID</p>
                  <p>For line item id, you need to
                    pass the Map&lt;String, Decimal&gt; map. The following keys are
                    expected:</p>
                  <ul>
                    <li>
                      <p>One Time Margin Lower Bound</p>
                    </li>

                    <li>
                      <p>One Time Margin Upper Bound</p>
                    </li>

                    <li>
                      <p>Recurring Margin Lower Bound</p>
                    </li>

                    <li>
                      <p>Recurring Margin Upper Bound</p>
                    </li>

                  </ul>
                </td>

              </tr>
            </tbody>
          </table>
2. Use the following sample code to customize the margin range interface implementation.
    
    ```
    global class SampleMarginRangeLoaderImplementation implements vlocity_cmt.VlocityOpenInterface
    {
        global Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output,
                                    Map<String, Object> options)
        {
            if (methodName.equals('loadMarginRanges'))
            {
                loadMarginRanges(input, output, options);
                return true;
            }
            return false;
        }
     
        private void loadMarginRanges(Map<String, Object> input, Map<String, Object> output,
                                      Map<String, Object> options)
        {
            //write your own logic
        }
    }
    ```