Newer Version Available
RTRReportResult Class
Namespace
Example
1cgcloud.RTRReportResult reportResult = cgcloud.RTRReportResult.execute(
2 'Promotion Report', // Report Name
3 '0001', // Sales Org
4 new Map<String, Object> { // Report filters
5 'periodmonth' => new Map<String, Object> {
6 'start' => 0,
7 'total' => 12,
8 'year' => 2022
9 },
10 'accountsfids' => new List<String> {'001SL0000004dfgYAA'},
11 'productsfids' => new List<String> {'01tSL00000018oNYAQ'},
12 'promo_templatesfid' => new List<String> {'a2USL0000000js12AA', 'a2USL0000000jrz2AA'},
13 'promo_phase' => new List<String> {
14 'Planning',
15 'Modeling',
16 'Committed',
17 'ForApproval'
18 },
19 'productlevel'=> 'product'
20 }
21);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:
1{ 2 "type": "singleselect", 3 "name": "kpigroup", 4 "label": "KPI Set", 5 "source": "KPIGroup" 6}Here's an example of how the filter using Apex looks:1... 2 'kpigroup' => 'Plan', 3... - multiselect
-
Here's an example of how the report's filter metadata looks:
1{ 2 "type": "multiselect", 3 "name": "promo_phase", 4 "label": "Promotion Phase", 5 "source": "PromotionPhase", 6 "defaultValue": [ 7 "Planning" 8 ] 9}Here's an example of how the filter using Apex looks:1... 2 'promo_phase' => new List<String> { 3 'Planning', 4 'Modeling', 5 'Committed', 6 'ForApproval' 7 }, 8... - periodmonth
-
Here's an example of how the report's filter metadata looks:
1{ 2 "label": "Period", 3 "type": "periodmonth", 4 "name": "periodmonth" 5}Here's an example of how the filter using Apex looks:1... 2 'periodmonth' => new Map<String, Object> { 3 'start' => 0, // The starting month. A value between 0 (January) and 11 (December) 4 'total' => 12, // How many month data to retrieve. A value between 1 and 18 5 'year' => 2022 // The starting year 6 }, 7... - periodweek
-
Here's an example of how the report's filter metadata looks:
1{ 2 "label": "Period", 3 "type": "periodweek", 4 "name": "periodweek" 5}Here's an example of how the filter using Apex looks:1... 2 'periodweek' => new Map<String, Object> { 3 'start' => 0, // The starting Week. A value between 0 (First week of the year) to 70 4 'total' => 12, // How many weeks data to retrieve. A value between 1 and 100 5 'year' => 2022 // The starting year 6 }, 7... - hidden
-
Here's an example of how the report's filter metadata looks:
1{ 2 "label": "Not Seen", 3 "type": "promo_s_textfield", 4 "name": "hidden", 5 "defaultValue" : "<<FIRST_VALUE>>", 6 "source" : [{ 7 "label" : "example", 8 "value" : "value1" 9 }] 10}Here's an example of how the filter using Apex looks:1... 2 'promo_s_textfield' => 'value1', 3... - fixed
-
Here's an example of how the report's filter metadata looks:
1{ 2 "label": "Fixed Filter", 3 "type": "promo_s_textfield2", 4 "name": "fixed", 5 "defaultValue" : "<<FIRST_VALUE>>", 6 "source" : [{ 7 "label" : "example", 8 "value" : "value1" 9 }] 10}Here's an example of how the filter using Apex looks:1... 2 'promo_s_textfield2' => 'value1', 3... - subaccount
-
Here's an example of how the report's filter metadata looks:
1{ 2 "type": "subaccount", 3 "name": "subaccountsfids", 4 "label": "Sub Accounts", 5 "accountfilter": "accountsfids", 6 "source": "SubAccounts" 7}Here's an example of how the filter using Apex looks:1... 2 'subaccountsfids' => new List<String> { '001SL0000004dfgYAA' }, 3...
RTRReportResult Methods
The following are methods for RTRReportResult.
execute(String name, String salesOrg, Map<String, Object> filters)
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
getComponent(String name)
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
- For the Flatlist component, specify the response to RTRReportResult.FlatList
- For the Scorecard component, specify the response to RTRReportResult.ScoreCard