Deploy the TPM Accruals Data Kit
Deploy the TPM accruals data kit to install the required data streams, models, and transformations in Data Cloud.
Required Editions
Available in: Lightning Experience Available in: Enterprise and Unlimited Editions where Trade Promotion Management, Data Cloud, and CRM Analytics are enabled |
| User Permissions Needed | |
|---|---|
| To deploy TPM Accruals data kit: | CGCloud Business Admin |
Complete these prerequisites before you proceed.
- Download and install Node.js from nodejs.org. To verify the installation, run node --version in your terminal.
- Install Salesforce CLI. To verify the installation, run sfdx --version in your terminal.
- Authenticate to a Salesforce org that has Data Cloud enabled. Run sfdx force:auth:web:login -a your-org-alias and set the SF_ORG_ALIAS environment variable to your org alias.
- The Accruals Engine is turned on in the Accruals setup page.
- To view the TPM-specific setup subsection, you need the TPM-specific accrual add-on license.
- Align your org alias with Salesforce org alias. Run export SF_ORG_ALIAS=your-org-alias.
- From the Data Cloud Setup, in the Quick Find box, enter Feature Manager, and then select Feature Manager.
-
Scroll to the Connectors setting and make sure that it's enabled.
The accruals functionality relies on beta connectors to the Data Cloud.
-
Download and unzip the add-on package.
- Switch back to the standard Salesforce Setup.
- From Setup, go to Static Resources.
- Search for and select CGCloudAddons.
- Click View file to download the CGCloudAddons static resource file.
- Unzip the downloaded file.
-
Prepare the data kit metadata.
- Go to the /TPM/Accruals/TPM Accruals Data Kit folder within the unzipped files.
- In this folder, perform a find-and-replace operation. Find all instances of the placeholder __SF_ORG_ID__ and replace them with your 15-digit Salesforce org ID.
-
Deploy the metadata by using the
Salesforce CLI.- In a terminal, go to the TPM Accruals Data Kit folder.
- Set the environment variable to your org alias.
-
Run the command:
sf project deploy start --target-org <your-org-alias>
- In your command-line interface, go to the /TPM/Accruals/Accruals Data Kit Deployment Scripts folder within the unzipped files.
-
Run the deployment script.
node deploy-tpm-accruals.js -u <your-org-alias> -
In Local Deployment History, verify that the Deployment Status for the 19 data streams,
3 data lake objects, and 4 data transformations is Successful. To verify the deployment
status, use one of these methods.
- From the UI: Go to Data Cloud Setup, select Data Kits, and then select TPM Accruals. In Local Deployment History, verify that the status is Successful.
- From the database: In the Developer Console, run this query: select id, DeploymentStatus, ComponentName, DeploymentError, CreatedDate from DataKitDeploymentLog order by CreatedDate desc.
For the list of data streams, data lake objects, and data transformations, see Deployed Accrual Data Components.
Note If the deployment fails, delete the data streams and rerun the script. -
Check the deployment status.
- To check the deployment status from the UI, go to Data Cloud setup, find and select Data Kit, and click TPM Accruals.
- To check the deployment status from the database, select ID, DeploymentStatus, ComponentName, DeploymentError, CreatedDate from DataKitDeploymentLog order by CreatedDate desc.
14 data streams, 1 data lake object, and 3 data transformations are deployed. -
Schedule a recurring data transfer by running a schedulable Apex class from the
Developer Console.
- In the Developer Console, open the Execute Anonymous window.
-
To schedule a simple job, use the
System.schedulemethod.This example code schedules a job named DataCloud to run at the 45th minute of every hour. It includes two data streams:promotionmeasuresanddailymeasurereal. Modify the data stream names as needed.// Schedules the job to run at the 45th minute of every hour. System.schedule('DataCloud', '0 45 * * * ?', new cgcloud.DataCloudExportScheduler( new List<String>{'promotionmeasures','dailymeasurereal'})); -
To create a scheduled job with specific filters, use
DataCloudExportSchedulerBuilder.This method allows you to specify which tables, sales orgs, measures, and accounts to include.// Define the tables to include in the transfer. List<String> requestTables = new List<String>{ 'promotionmeasures', 'dailymeasurereal', 'dailymeasureint', 'paymenttacticmeasures' }; // Build the scheduler request with filters. DataCloudExportScheduler.DataCloudExportSchedulerBuilder schedulerBuilder = new DataCloudExportScheduler.DataCloudExportSchedulerBuilder(); schedulerBuilder.withTables(requestTables) .withIncludeSalesOrgs(new List<String>{ '0001', '0002' }) .withFilter( new Map<String, Object>{ 'measures' => new List<String>{ 'PPIV', 'PABV' }, 'syncfromdate' => '2024-01-01', 'accounts' => new List<String>{ '001xx0000000001AAA', '001xx0000000002AAA' } } ); DataCloudExportScheduler scheduler = schedulerBuilder.build(); // Schedule the job to run daily at 8:29 AM. System.schedule('Export With All Filters', '0 29 8 * * ?', scheduler);
Did this article solve your issue?
Let us know so we can improve!

