MuleSoft Accelerator for Retail
Use case 2 - Sales order sync
Enable a single view of your sales orders by simplifying connectivity between ERP, CRM, OMS, marketing and commerce systems
Overview
- Description
- Glossary
- Solution overview
- Assumptions and constraints
- High-level architecture
- Activity diagram
- Processing logic
- Successful outcome
Use case extensions
See also
The Sales Order Sync use case enables retail developers to create and update sales orders across disparate systems. Simplify connectivity between ERP, CRM, OMS, marketing and commerce systems with pre-built APIs, connectors, and implementation templates. This solution streamlines manual processes and eliminates duplication.
Retailers can connect sales orders to help calculate the total lifetime value of a customer across multiple channels. Syncing sales orders also helps retailers provide better service experiences.
Description
The sales order sync use case enables retail developers to create and update sales orders across relevant applications, regardless of which application the order is created in and where it is fulfilled.
The sales order sync achieves the following goals:
- Support the creation of sales orders across relevant applications, inclusive of Salesforce Clouds and SAP
- Support the creation of Global ID and ID attribution.
- Orchestrate controlled updates across designated applications.
- Link sales orders with customers and products using global identifiers.
Glossary
Term | Definition |
---|---|
CIM | The Cloud Information Model defines a set of standard data structures that can be used as canonical representations of common entities for integrating systems. |
Global Data | A Global Data service provides an accurate, consistent, and complete copy of business data for use by enterprise applications and business partners while also providing a means to link that copy to occurrences in other systems. |
OMS | An Order Management System is a software solution that supports the management and processing of sales orders. |
Solution overview
- Capture new sales orders published from B2C Commerce.
- Capture sales order updates made in SAP S/4HANA.
Sales order creation and updates will be captured in Salesforce core.
- All updates will be reflected in Salesforce core first to establish the ID graph.
- Orders will be associated with the global customer ID in Salesforce core.
New or updated orders will be synchronized with the same downstream systems.
- Global identifier from Salesforce core will be recorded in the other systems.
The global identifier will be recorded back to the system that published the update, if it was not provided.
- CIM entities supported (system agnostic): SalesOrder, SalesOrderProduct* (you can have multiple products for a given order), Customer, Individual.
Primary criteria used to match an existing sales order in other systems, in order of priority:
- Global identifier.
- External identifier specific to target system.
If the customer profile could not be found, or if not given with the order at all, the order will be associated with a predetermined generic customer profile. This profile must be identified and/or created ahead of time (see below).
- In target systems, a new order will be created if not matched to an existing one.
- Update errors will be reported in the logs and sent to the appropriate dead-letter queue only; no conflict resolution support will be implemented.
Assumptions and constraints
The following will be used to guide or constrain the solution design at a high level:
- The Cloud Information Model (CIM) will be used as the canonical model for all business types; see the CIM usage guidelines in that asset.
- Global identifiers will be maintained in Salesforce core. Wherever possible, these will be assigned as external identifiers in target systems.
- References to the global IDs will be reflected in downstream systems using custom properties to avoid conflicts with the usage of other external identifiers.
- Salesforce core will record only minimal information about the sales order in addition to establishing the customer relationship and maintaining the identifier graph.
High-level architecture
Activity diagram
Processing logic
The primary handling and orchestration of sales orders will be implemented in the Orders Process API. This process can be described as follows:
Salesforce core updates
- If a customer profile was given with the sales order, find a matching entry in Salesforce core. If a single match is found, associate the global customer profile with the order.
- If no match is found, or if a customer profile was not given, associate the order with the predefined generic customer profile.
Find a matching sales order entry in Salesforce core. The lookup will be done by attempting to match on the following criteria, in sequential order, returning once a match has been found:
- Global Identifier (if provided)
- External Identifier (of source system)
If a single match is found:
- Retrieve the existing sales order
- Apply the incoming updates and save them back to Salesforce core
- If not matched on external identifier, associate it with the sales order
- Invoke APIs to update the downstream systems (see below)
- Associate missing external identifiers back to Salesforce core
If no match was found:
- Create a new sales order in Salesforce core
- Associate external identifier of source system with the sales order
- Invoke System APIs to update the downstream systems (see below)
- Associate new external identifiers back to Salesforce core
Downstream system updates
The replication of sales order updates to downstream systems follows a similar process as for Salesforce core. The following steps apply to all downstream systems:
Assign the customer identifier(s) specific to the target system to the downstream order details
- External ids should include Salesforce core and the system(s) specific to the downstream API being invoked
Find a matching sales order in the target. The lookup will be similar as for Salesforce core but using the following criteria, also in order by priority:
- Primary identifier in target system (if one has been associated)
- Global identifier from Salesforce core
If a single match is found:
- Retrieve the existing sales order and apply the incoming updates
- If not matched on global identifier, associate it with the entity
- Save the updates back to the target system
If no match was found:
- Create a new entity in the target system
- Associate the global identifier with the new entity
- Report the system identifier of the new entity to the parent process
Successful outcome
After successfully completing the update processing for all target systems, the following conditions will be met:
- Salesforce core holds a record of the sales order, associated with a customer (may be the generic one)
- All target systems will hold at least some minimal representation of the same
- The entity created/updated in each system will reference the global identifier from Salesforce core
- Salesforce core holds a list of all external identifiers associated with the sales order
- A 360-degree view of the order can be constructed by first retrieving the global copy from Salesforce core, and then from all associated downstream systems
- The total lifetime value of a customer can be calculated
Sales order create sync from B2C Commerce
Overview
This use case records new orders published from B2C Commerce via the sync cartridge.
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. |
Workflow
- The use case is triggered when a sales order is created in B2C Commerce
- A sync cartridge invokes the B2C Commerce Experience API with the sales order data.
- The B2C Commerce Experience API converts the sales order data to the CIM format and places it in a queue
The Orders Process API consumes the message from the queue and orchestrates the following by invoking the appropriate system APIs for each system:
- Create or update the sales order in Salesforce core with an associated global ID.
- Create or update the sales order in SAP S/4HANA with an external ID that links to the global ID in Salesforce core.
- Create or update the sales order in Salesforce with an external ID that links to the global ID in Salesforce core.
- Update the sales order in Salesforce core with a list of external IDs that link the order to its corresponding profiles in B2C Commerce, Salesforce and SAP S/4HANA.
- Update B2C Commerce with the global ID from Salesforce core.
Sequence diagram
Systems involved
- B2C Commerce
- Salesforce core
- SAP S/4HANA
- Salesforce
Setup instructions
Generic customer profile
As mentioned above, the Orders Process API will associate any anonymous orders with a predefined generic customer profile. The preferred way to set this up is to create a new customer directly in the preferred system (e.g., Salesforce) for this purpose and have it automatically sync to all downstream systems that are configured as part of Use case 1 - Customer profile sync. The Salesforce identifier must then be referenced in appropriate configuration property of the API.
B2C Commerce configuration
Setup B2C Commerce with the sync cartridge to invoke the B2C Commerce Experience API when a sales order is created or updated. The custom cartridge needs to be properly installed in the active site by a qualified B2C administrator or developer.
Follow the B2C setup guide for instructions on how to configure the target B2C Commerce instance for API access.
Salesforce configuration
Follow the Salesforce Customization Guide to create custom fields and enable Person Accounts.
Salesforce core configuration
Follow the setup instructions in the Prerequisites tab of the Salesforce core System API.
SAP S/4HANA configuration
Follow the setup instructions in the SAP S/4HANA Setup Guide.
Sales order update sync from SAP S/4HANA
Overview
This use case records updates to sales orders published from SAP S/4HANA.
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. |
Workflow
- The SAP Event Listener is invoked when the order status is updated in SAP S/4HANA. It converts the sales order data to the CIM format and places it in a queue.
The Orders Process API consumes the message from the queue and orchestrates the following by invoking the appropriate system APIs for each system:
- Create or update the sales order in Salesforce core with the updated order status from SAP S/4HANA.
- Create or update the sales order in Salesforce with the updated status from SAP S/4HANA.
- Update the sales order in B2C Commerce with the updated order status from SAP S/4HANA.
Sequence diagram
Systems involved
- B2C Commerce
- Salesforce core
- SAP S/4HANA
- Salesforce
Setup instructions
B2C Commerce configuration
Setup B2C Commerce with the sync cartridge to invoke the B2C Commerce Experience API when a sales order is created or updated. The custom cartridge needs to be properly installed in the active site by a qualified B2C administrator or developer.
Follow the B2C setup guide for instructions on how to configure the target B2C Commerce instance for API access.
Salesforce configuration
Follow the Salesforce Customization Guide.
Salesforce core configuration
Follow the setup instructions in the Prerequisites tab of the Salesforce core System API.
SAP S/4HANA configuration
Follow the setup instructions in the SAP S/4HANA Setup Guide.
Downloadable assets
Accelerator System APIs
- RCG B2C Commerce System API | API Specification | Implementation Template
- RCG Salesforce Orders System API | API Specification | Implementation Template
- Accelerator Salesforce Global SalesOrders System API | API Specification| Implementation Template
- SAP S/4HANA Orders System API | API Specification | Implementation Template
- RCG Oracle EBS Order System API | API Specification | Implementation Template
Accelerator Process APIs
- Accelerator SalesOrders Process API | API Specification | Implementation Template
- RCG ERP Orders Process API | API Specification | Implementation Template
Accelerator Experience APIs
- RCG B2C Commerce Experience API | API Specification | Implementation Template
Accelerator Listeners
- RCG SAP Event Listener | Implementation Template
Custom components
- RCG B2C Commerce Sync Cartridge | Source