---
schema_version: "1"
id: f0f8e7bdb06e7ac58f3adcdf5a20ac9041d0395c0a1f7570048829dcd4403af9
title: RTRReportResult Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/apex_class_CGCloud_RTRReportResult.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/apex_class_CGCloud_RTRReportResult.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 11df1e78d77f93efc9702552dd1a77246710a420e995e4eae4e6657e243a8f4a
description: Use this class to execute the Trade Promotion Management Real Time Reporting (RTR) report and access the report data.Execute a RTR Report and retrieve all the Report data.Retrieve an instance of the Reporting UI component.
---
# RTRReportResult Class

Use this class to execute the Trade Promotion Management Real Time Reporting (RTR) report and access the report data.

## Namespace

[CGCloud](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/apex_namespace_CGCloud.htm "The CGCloud namespace provides classes that allow you to customise Real Time Reporting (RTR) data extraction from Apex.")

## Example

Here’s an example of how to use Apex to run the Trade Promotion Management Real Time Reporting reports.

cgcloud.RTRReportResult reportResult = cgcloud.RTRReportResult.execute(
    'Promotion Report',  // Report Name
    '0001',  // Sales Org
    new Map<String, Object\> { // Report filters
        'periodmonth' => new Map<String, Object\> {
            'start' => 0,
            'total' => 12,
            'year' => 2022
        },
        'accountsfids' => new List<String\> {'001SL0000004dfgYAA'},
        'productsfids' => new List<String\> {'01tSL00000018oNYAQ'},
        'promo\_templatesfid' => new List<String\> {'a2USL0000000js12AA', 'a2USL0000000jrz2AA'},
        'promo\_phase' => new List<String\> {
            'Planning',
            'Modeling',
            'Committed',
            'ForApproval'
        },
        'productlevel'\=> 'product'
    }
);

This returns an instance of a RTRReportResult object after running the report. Use the methods provided by the RTRReportResult class to access the report data.

Filters can be specified for the report execution. The report filters specified match the filters defined in the RTR Report Metadata configuration (RTR Report Configuration SObject record). Depending on the filter type, the expected filter must have a specific structure or type.

**singleselect**

Here's an example of how the report's filter metadata looks:

{
    "type": "singleselect",
    "name": "kpigroup",
    "label": "KPI Set",
    "source": "KPIGroup"
}

Here's an example of how the filter using Apex looks:

...
    'kpigroup' => 'Plan',
...

**multiselect**

Here's an example of how the report's filter metadata looks:

{
    "type": "multiselect",
    "name": "promo\_phase",
    "label": "Promotion Phase",
    "source": "PromotionPhase",
    "defaultValue": \[
        "Planning"
    \]
}

Here's an example of how the filter using Apex looks:

...
    'promo\_phase' => new List<String\> {
        'Planning',
        'Modeling',
        'Committed',
        'ForApproval'
    },
...

**periodmonth**

Here's an example of how the report's filter metadata looks:

{
    "label": "Period",
    "type": "periodmonth",
    "name": "periodmonth"
}

Here's an example of how the filter using Apex looks:

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

#### Note

The filter must be represented by an object with the year, start, and total properties.

...
    'periodmonth' => new Map<String, Object\> {
        'start' => 0, // The starting month. A value between 0 (January) and 11 (December)
        'total' => 12, // How many month data to retrieve. A value between 1 and 18
        'year' => 2022 // The starting year
    },
...

**periodweek**

Here's an example of how the report's filter metadata looks:

{
    "label": "Period",
    "type": "periodweek",
    "name": "periodweek"
}

Here's an example of how the filter using Apex looks:

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

#### Note

The filter must be represented by an object with the year, start, and total properties.

...
    'periodweek' => new Map<String, Object\> {
        'start' => 0, // The starting Week. A value between 0 (First week of the year) to 70 
        'total' => 12, // How many weeks data to retrieve. A value between 1 and 100
        'year' => 2022 // The starting year
    },
...

**hidden**

Here's an example of how the report's filter metadata looks:

{
     "label": "Not Seen",
     "type": "promo\_s\_textfield",
     "name": "hidden",
     "defaultValue" : "<<FIRST\_VALUE>>",
     "source" : \[{
        "label" : "example",
        "value" : "value1"
     }\]
}

Here's an example of how the filter using Apex looks:

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

#### Note

The filter must be represented with a string.

...
    'promo\_s\_textfield' => 'value1',
...

**fixed**

Here's an example of how the report's filter metadata looks:

{
     "label": "Fixed Filter",
     "type": "promo\_s\_textfield2",
     "name": "fixed",
     "defaultValue" : "<<FIRST\_VALUE>>",
     "source" : \[{
        "label" : "example",
        "value" : "value1"
     }\]
}

Here's an example of how the filter using Apex looks:

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

#### Note

The filter must be represented with a string.

...
    'promo\_s\_textfield2' => 'value1',
...

**subaccount**

Here's an example of how the report's filter metadata looks:

{
    "type": "subaccount",
    "name": "subaccountsfids",
    "label": "Sub Accounts",
    "accountfilter": "accountsfids",
    "source": "SubAccounts"
}

Here's an example of how the filter using Apex looks:

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

#### Note

The filter must be represented with a List of strings.

...
    'subaccountsfids' => new List<String\> { '001SL0000004dfgYAA' },
...

- **[RTRReportResult Methods](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/apex_class_CGCloud_RTRReportResult.htm#apex_CGCloud_RTRReportResult_methods)**

## RTRReportResult Methods

The following are methods for RTRReportResult.

- **[execute(String name, String salesOrg, Map<String, Object> filters)](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/apex_class_CGCloud_RTRReportResult.htm#apex_CGReporting_execute)**  
    Execute a RTR Report and retrieve all the Report data.
- **[getComponent(String name)](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/apex_class_CGCloud_RTRReportResult.htm#apex_CGReporting_getComponent)**  
    Retrieve an instance of the Reporting UI component.

### execute(String name, String salesOrg, Map<String, Object> filters)

Execute a RTR Report and retrieve all the Report data.

#### Signature

static RTRReportResult execute(String name, String salesOrg, Map<String, Object\> filters)

#### Parameters

- **name**: Type:String. The name of the RTR report configuration to execute.
- **salesOrg**: Type:String. The Salesforce org name to execute the report on.
- **filters**: Type:String. Report filters as defined in the RTR report metadata.
    
    The filters attribute must align with the expected filters as defined in the RTR reporting configuration.

#### Return Value

Type:[RTRReportResult](#apex_class_CGReporting_RTRReportResult "Use this class to execute the Trade Promotion Management Real Time Reporting (RTR) report and access the report data.")

### getComponent(String name)

Retrieve an instance of the Reporting UI component.

#### Signature

static RTRReportResult execute(String name, String salesOrg, Map<String, Object\> filters)

#### Parameters

- **name**: Type:String. The name of the reporting component as defined in the report metadata uimapping.

#### Return Value

Type:[ReportComponent](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/apex_class_CGCloud_RTRReportResult_ReportComponent.htm#apex_class_CGReporting_RTRReportResult_ReportComponent "Represents a Real Time Reporting (RTR) report UI component. This is an abstract class and can’t be instantiated.")

- For the Flatlist component, specify the response to RTRReportResult.FlatList
- For the Scorecard component, specify the response to RTRReportResult.ScoreCard