MuleSoft Accelerator for Consumer Goods
Use case 4 - Trade promotion optimization
Integrate predictive baseline data from CRM Analytics into Hyperforce for trade promotion optimization, enabling data-driven insights into promotion effectiveness, aiding in designing targeted promotions aligned with consumer behavior, and facilitating accurate ROI calculations by assessing market risks.
Overview
- Description
- Solution definition
- Assumptions and constraints
- High-level architecture
- Activity diagram
- Processing logic
See also
Description
Trade promotion optimization (TPO) is a strategic process used by consumer goods companies to maximize the effectiveness and efficiency of trade promotions. It involves analyzing historical data and market trends to forecast the impact of promotions, creating and evaluating multiple scenarios, and utilizing optimization algorithms to determine the optimal mix of promotional activities. TPO helps companies allocate resources effectively, increase sales revenue, improve profitability, and measure the performance of promotions. By taking a data-driven approach, TPO enables companies to optimize their promotional strategies and achieve their business objectives.
In this use case, forecasted weekly sales data is extracted from CRM Analytics, seamlessly integrated into Hyperforce, and supported by strategic logic and orchestration to ensure API compliance and optimize performance efficiency for Hyperforce.
Glossary
Term | Definition |
---|---|
CG | Consumer Goods |
CRMA | CRM Analytics |
OS | Object Store |
Hyperforce | Salesforce Hyperforce extends CRM services to major public cloud platforms for improved scalability, global reach, and flexibility |
Goals
- Support the extraction, transformation and loading of predictive baseline data from Salesforce CRM Analytics to Hyperforce.
- Transform the predictive baseline data after merging it with the metadata from the schema files.
- Orchestrate the Hyperforce Volume Management APIs to create transactions, messages and ingest volumes data in Hyperforce.
- Upload the forecast data to Hyperforce.
- Archive the successfully processed files.
Use case considerations
- Salesforce Volume Management System API will enhance the backend Hyperforce APIs to provide a secure layer and orchestrate the multiple backend API requests to comply with the below limitations of the Volume Management APIs.
- The payload size must not exceed 30MB
- Transaction size should fall within the range of 1 to 2147483646
Salesforce Volume Management System API supports the following:
- Create Transactions
- Create Volume Measures per transaction
- Send volumes measures for a given transaction with mode as weekly and format as decimal in the payload request
- Get status information for a given transaction
- Get Request volumes for a given date
- It can only be utilized once the message limit has been reached
The Baseline Prediction Process API gets triggered as soon as the files are available in Amazon S3.
- The Baseline Prediction Process API reads the file name in the schema.json file to determine the column names and merge it with the forecast files in CSV format.
- The Baseline Prediction Process API splits the file into 30 MB chunks using the For-each scope and sends the create transaction requests to Salesforce Volume Management System API.
- The Baseline Prediction Process API sends a request to the Salesforce Volume Management System API to create condition measures with mode as
weekly
and format asdecimal
. - The Baseline Prediction Process API then sends the volume measures for the registered transaction until it reaches the limit of the transaction or until all the split messages are sent over to the Salesforce Volume Management System API.
- If the limit of a transaction is reached before all the files are processed, the Baseline Prediction Process API appends a counter to the transaction name and creates a new transaction.
- The files are moved to archive folder after they are successfully uploaded to Hyperforce via the Salesforce Volume Management System API.
Technical considerations
- Prior to setting up the integration, ensure that the outbound connection to S3 from CRM Analytics is configured correctly, following these guidelines as documented here
End-to-end scenarios
- Predictive baseline data for Trade Promotion Optimization is synchronised between Salesforce CRM Analytics and Hyperforce.
Solution definition
The primary set of use cases covered in the current solution involves the synchronisation of ForecastedSales and ForecastWeek files from CRM Analytics to Hyperforce.
Goal
Integrate predictive baseline data from Salesforce CRM Analytics to Hyperforce.
Main success scenario
- An event is triggered to the Baseline Prediction Process API as soon as the files are placed in S3. This can also be setup as a scheduled job at a configured frequency to read the files from S3.
- The Baseline Prediction Process API checks for the two sets of files
- Weekly dataset (schema.json and data.csv)
- Forecast dataset (schema.json and data.csv)
- The Baseline Prediction Process API appends both the CSV files with the column headers from the respective schema.json file to create a composite CSV file with headers
- The Baseline Prediction Process API transforms the file as per the Hyperforce JSON format
- If the JSON payload size is more than 30MB, then the Baseline Prediction Process API splits the json payload using the for-each scope into multiple messages of 30 MB size each.
- For the first file, the Baseline Prediction Process API invokes the Salesforce Volume Management System API to create a transaction with the configured number of messages.
- For the registered transaction in Step 5, the Baseline Prediction Process API invokes the Salesforce Volume Management System API to create volume measures to send data in the weekly mode and decimal format.
- The Baseline Prediction Process API invokes the Salesforce Volume Management System API to send messages to the transaction created in Step 5 until all the messages are sent over to Hyperforce.
- If the actual number of messages from the JSON file exceeds the registered number of messages in a transaction, the Baseline Prediction Process API increments the suffix of the transactionName by 1 and updates the object store in mule with the new transaction name.10.The Baseline Prediction Process API moves the successful files to the archive folder and the failed files if any to the error folder in S3.
Assumptions and constraints
The following will be used to guide or constrain the solution design at a high level:
- The payload size should not be more than 30MB
- Transaction size: min: 1 and max: 2147483646.
- Decimal value value accepted is 2147483673 and rounded off to the 7 place.
High-level architecture
Activity diagram
The diagram below illustrates the sequence of processing the ForecastedSales and ForecastWeek files from CRM Analytics to Hyperforce.
Processing logic
The primary handling and orchestration of processing of ForecastedSales and ForecastWeek files from CRM Analytics will be implemented in the Baseline Process API). This process can be described as follows:
- An event is triggered from S3 as soon as the files are put into the S3 bucket.
- The Baseline Prediction Process API checks for .csv and .json files in ForecastedSales and ForecastWeek folders.
- When all the four files are present in S3, the Baseline Prediction Process API appends both the CSV files with the column headers from the respective schema.json file to create a composite CSV file with headers
- If the JSON payload size is more than 30MB, then the Baseline Prediction Process API splits the json payload using the for-each scope into multiple messages of 30 MB size each.
- For the first file, the Baseline Prediction Process API invokes the Salesforce Volume Management System API to create a transaction with the configured number of messages.
- For the registered transaction in Step 6, the Baseline Prediction Process API invokes the Salesforce Volume Management System API to create volume measures to send data in the weekly mode and decimal format.
- The Baseline Prediction Process API invokes the Salesforce Volume Management System API to send messages to the transaction created in Step 6 until all the messages are sent over to Hyperforce.
- If the actual number of messages from the JSON file exceeds the registered number of messages in a transaction, the Baseline Prediction Process API increments the suffix of the transactionName by 1 and updates the object store in mule with the new transaction name.
- The Baseline Prediction Process API moves the successful files to the archive folder and the failed files if any to the error folder in S3.
Before you begin
The Getting Started with MuleSoft Accelerators guide provides general information on getting started with the accelerator components. This includes instructions on setting up your local workstation for configuring and deploying the applications. |
Downloadable assets
Accelerator System APIs
- RCG Salesforce Volume Management System API | API Specification | Implementation Template
Accelerator Process APIs
- RCG Baseline Prediction Process API | API Specification | Implementation Template