---
schema_version: "1"
id: 533226de7f03782648bca1cf4d9eabdf8e4e03e7a16f86a6fb165f30cdea38d3
title: "Use Case: Fund Amount"
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/cgcloud_rtr_dev_guide/tpm_rtr_custom_datasource_fund_amount.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.cgcloud_rtr_dev_guide.meta/cgcloud_rtr_dev_guide/tpm_rtr_custom_datasource_fund_amount.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 014ef7c5e4fe074798308d6d7a24228380c662d273b133f49084a00c854e1461
description: The Fund object stores the fund amount in Salesforce. To show a fund amount for a particular category or brand, fetch it from the Salesforce database by using custom data sources.
---
# Use Case: Fund Amount

The Fund object stores the fund amount in Salesforce. To show a fund amount for a particular category or brand, fetch it from the Salesforce database by using custom data sources.

## Prerequisites

1. Create a KPI definition for the fund amount. For this KPI definition, ensure that the object scope is Account and it has the writeback feature enabled.
    
    ![Note](https://developer.salesforce.com/docs/atlas.en-us.cgcloud_rtr_dev_guide.meta/cgcloud_rtr_dev_guide/images/icon_note.png)
    
    #### Note
    
    This KPI definition only provides a name for the external KPI. The Apex class defines how to input values in this KPI.
2. Enter the name of the datasource table as Account Measure.
3. Add the KPI to the Reporting KPI set that's used in the report.

## Report Configuration

Apart from defining RTRSalesforceMonthlyMeasures as an additional datasource in the report configuration, ensure that you add the newly created KPI to the list of measures.

{
"label": "Fund Amount",
"name": "myFndAmount"
},

## Apex Classes

The custom data sources are related to two base Apex classes. You can use both classes only for code-routing and not to perform any actual logic, queries, or calculations; this is because all reports share these classes.

![Note](https://developer.salesforce.com/docs/atlas.en-us.cgcloud_rtr_dev_guide.meta/cgcloud_rtr_dev_guide/images/icon_note.png)

#### Note

In RTR, integration users run both the Apex classes, not the user who opens the report. As a result, integration users must have access permissions to the used Apex classes.

- **[TPM\_RTRReportingWrapper\_AMS (Base Class)](https://developer.salesforce.com/docs/atlas.en-us.cgcloud_rtr_dev_guide.meta/cgcloud_rtr_dev_guide/tpm_rtr_class_tpm_rtrreportingwrapper_ams.htm)**  
    TPM\_RTRReportingWrapper\_AMS is a base Apex class that receives the payload that's constructed by filter selection in the report. The payload contains the KPIs that are defined in the report, the customer, dates, and other important attributes. It then deserializes the payload into an object that can be used in all other related classes.
- **[TPM\_RTRSalesforceMonthlyMeasures\_AMS (Base Class)](https://developer.salesforce.com/docs/atlas.en-us.cgcloud_rtr_dev_guide.meta/cgcloud_rtr_dev_guide/tpm_rtr_class_rtrsalesforcemonthlymeasures_ams.htm)**  
    TPM\_RTRSalesforceMonthlyMeasures\_AMS is one of the base classes that's used for code-routing and is required to retrieve the information by a Salesforce REST endpoint (/services/apexrest/RTRSalesforceMonthlyMeasures).
- **[TPM\_RTRFunds\_AMS (The Logic Class)](https://developer.salesforce.com/docs/atlas.en-us.cgcloud_rtr_dev_guide.meta/cgcloud_rtr_dev_guide/tpm_rtr_class_rtrfunds_ams.htm)**  
    Use RTRSalesforceMonthlyMeasures as the datasource to execute the base classes by every report.