AnalyticSnapshot

Represents a reporting snapshot. A reporting snapshot lets you report on historical data. Authorized users can save tabular or summary report results to fields on a custom object, then map those fields to corresponding fields on a target object. They can then schedule when to run the report to load the custom object’s fields with the report’s data. Reporting snapshots enable you to work with report data similarly to how you work with other records in Salesforce.

Parent Type 

This type extends Metadata and inherits its fields.

File Suffix and Directory Location 

Lightning Platform AnalyticSnapshot components are stored in the analyticSnapshots directory of the corresponding package directory. The file name matches the unique name of the reporting snapshot, and the extension is .snapshot.

Version 

Lightning Platform AnalyticSnapshot components are available in API version 16.0 and later.

Fields 

description 

  • Type: string
  • Required: No
  • Description: A description of the reporting snapshot.

groupColumn 

  • Type: string
  • Required: No
  • Description: A column that specifies which level to extract data from the source report. It’s only applicable for summary reports.

mappings 

name 

  • Type: string
  • Required: Yes
  • Description: Required. The display name of the reporting snapshot.

runningUser 

  • Type: string
  • Required: No

sourceReport 

  • Type: string
  • Required: Yes

targetObject 

  • Type: string
  • Required: Yes

AnalyticSnapshotMapping Type 

AnalyticSnapshotMapping defines the mapping for the reporting snapshot. Valid values are:

Fields 

aggregateType 

sourceField 

  • Type: string
  • Required: Yes

sourceType 

targetField 

  • Type: string
  • Required: Yes

ReportJobSourceTypes Type 

An enumeration of type string that defines the report format for the reporting snapshot.

Declarative Metadata Sample Definition 

Here’s a sample XML definition of a reporting snapshot.

1<?xml version="1.0" encoding="UTF-8"?>
2<AnalyticSnapshot xmlns="http://soap.sforce.com/2006/04/metadata">
3    <description>my description</description>
4    <groupColumn>INDUSTRY</groupColumn>
5    <mappings>
6        <aggregateType>Average</aggregateType>
7        <sourceField>SALES</sourceField>
8        <sourceType>summary</sourceType>
9        <targetField> myObject __c.Name</targetField>
10    </mappings>
11    <mappings>
12        <sourceField>ExecutionTime</sourceField>
13        <sourceType>snapshot</sourceType>
14        <targetField> myObject __c.field3__c</targetField>
15    </mappings>
16    <mappings>
17        <sourceField>INDUSTRY</sourceField>
18        <sourceType>tabular</sourceType>
19        <targetField>testObject__c.Name</targetField>
20    </mappings>
21    <name>my snapshot</name >
22    <runningUser>user@salesforce.com</runningUser>
23    <sourceReport>myFolder/mytSummaryReport</sourceReport>
24    <targetObject>myObject__c</targetObject>
25</AnalyticSnapshot>

Wildcard Support in the Manifest File 

This metadata type doesn’t support the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.