---
schema_version: "1"
id: ab590c7f7784e09720023292d0b2a063391f6b19cde9c81c525d6695ba68c9a0
title: TPM_RTRSalesforceMonthlyMeasures_AMS (Base Class)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/cgcloud_rtr_dev_guide/tpm_rtr_class_rtrsalesforcemonthlymeasures_ams.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.cgcloud_rtr_dev_guide.meta/cgcloud_rtr_dev_guide/tpm_rtr_class_rtrsalesforcemonthlymeasures_ams.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: f4bb1ed280444eb06e452d4a9595a6265a51ddcd032893ae3035972347e2fa03
description: 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\_RTRSalesforceMonthlyMeasures\_AMS (Base Class)

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).

The system sends the selected filter criteria and the list of KPIs as input payload to the REST endpoint. The APEX REST method then returns the fund amounts as output records to show in the report.

The fund values are returned by a function that's executed when a POST request is sent.

These steps are run within the Apex function:

1. The payload with filter values is converted into a format that can be used in the Apex code.
2. The time range (start and end date) is built by the selected month information.
3. The function that contains the logic for this use case is invoked.

**Sample Code**

@RestResource(urlMapping='/RTRSalesforceMonthlyMeasures/\*')
global with sharing class TPM\_RTRSalesforceMonthlyMeasures
{
@httpPost
global static List<TPM\_RTRReportingWrapper\_AMS.OutputRecord> doPost() {
String requestBody = RestContext.request.requestbody.tostring();
TPM\_RTRReportingWrapper\_AMS.InputPayload payload = (TPM\_RTRReportingWrapper\_AMS.InputPayload)
JSON.deserialize (requestBody , TPM\_RTRReportingWrapper\_AMS.InputPayload.class);
Date inputDateBegin = Date.newInstance(payload.periodmonth.year,payload.periodmonth.start,1);
Date inputDateEnd = inputDateBegin.addMonths( payload.periodmonth.total );
return TPM\_RTRFunds\_AMS.doPost( inputDateBegin , inputDateEnd, payload);
}
}