MuleSoft Accelerator for Consumer Goods icon

MuleSoft Accelerator for Consumer Goods

(0 reviews)

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

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

TermDefinition
CGConsumer Goods
CRMACRM Analytics
OSObject Store
HyperforceSalesforce 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 as decimal.
  • 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 details the integration approach for Trade Promotion Optimization, involving baseline prediction datasets to transfer forecast data from CRM Analytics to Hyperforce.

Goal

Integrate predictive baseline data from Salesforce CRM Analytics to Hyperforce.

Main success scenario

  1. 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.
  2. 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)
  3. 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
  4. The Baseline Prediction Process API transforms the file as per the Hyperforce JSON format
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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

TPO HLA

Activity diagram

The diagram below illustrates the sequence of processing the ForecastedSales and ForecastWeek files from CRM Analytics to Hyperforce.

TPO Activity diagram

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:

  1. An event is triggered from S3 as soon as the files are put into the S3 bucket.
  2. The Baseline Prediction Process API checks for .csv and .json files in ForecastedSales and ForecastWeek folders.
  3. 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
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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

bulb.png 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

Accelerator Process APIs

Common services (can be used across any use case)


Reviews

TypeCustom
OrganizationMuleSoft
Published by
MuleSoft Solutions
Published onJan 24, 2024
Asset overview

Asset versions for 5.2.x

Asset versions
VersionActions
5.2.0

Categories

Accelerator
Consumer GoodsNo values left to add
Industry Vertical
RetailConsumer GoodsNo values left to add

Tags