Catalog post-upsert flow
Note
This flow is self-documenting and should be viewed within Salesforce (Setup > Process Automations > Flows). This document is to support working through a visual flow. The flow commentary in this document was generated with AI assistance.
Overview#
Flow name: MoveData_Commerce_Catalog_Post Label: [MoveData] Commerce: Catalog - Post-Upsert Type: Auto-Launched Flow Template API version: 56.0 Status: Active
This flow manages post-processing operations for product catalog records in Salesforce, with a primary focus on price book entry management.
Purpose#
The flow performs several critical functions:
- Validates that an active Standard Price Book exists
- Creates or updates price book entries for products
- Manages pricing with multi-currency support
- Ensures products are configured for sales operations
- Synchronises prices between external platforms and Salesforce
- Maintains comprehensive audit logs
Salesforce fields#
| Field API name | Object | Field type | Purpose in flow |
|---|---|---|---|
| Id | Product2 | ID | Product record identifier |
| Id | PricebookEntry | ID | Price book entry identifier |
| Pricebook2Id | PricebookEntry | Lookup | Links to Standard Price Book |
| Product2Id | PricebookEntry | Lookup | Links to product record |
| UnitPrice | PricebookEntry | Currency | Product unit price |
| IsActive | PricebookEntry | Checkbox | Indicates active status |
| CurrencyIsoCode | PricebookEntry | Text | Currency code for entry |
Input variables#
| Variable | Type | Required | Description |
|---|---|---|---|
Record |
Product2 SObject | Yes | The Product2 record processed |
Price |
Currency | Yes | Product price from external source |
StandardPriceBookId |
String | Yes | Standard Price Book identifier |
CurrencyType |
String | No | Primary currency code |
Order_CurrencyType |
String | No | Fallback currency code |
Output variables#
| Variable | Type | Description |
|---|---|---|
Errors |
String[] | Collection of error messages |
Logs |
movedata__MoveDataLogEntry[] | Detailed debug log entries |
LogsJson |
String | JSON representation of logs |
RecordList |
String[] | Processed record IDs |
Flow logic#
1. Standard Price Book validation#
The flow validates the Standard Price Book's existence:
- Error: "Must have an active Standard Price Book" terminates processing if validation fails
- Ensures products can be properly priced within Salesforce
2. Currency code processing#
The flow applies formula logic:
- If
CurrencyTypeis blank, usesOrder_CurrencyTypeas fallback - Otherwise uses
CurrencyType
3. Price book entry lookup#
An Apex component (GetPriceBookEntryFlowComponent) searches for existing entries using:
- Currency code
- Price book ID
- Product ID
4. Price book entry processing decision#
Scenario A - Existing entry found:
- Compares existing UnitPrice with incoming Price value
- Updates only when prices differ
- Skips unnecessary updates
Scenario B - No entry found:
- Creates new PricebookEntry SObject
- Sets IsActive = true
- Assigns Product2Id, Pricebook2Id, UnitPrice
- Determines and assigns currency code if available
5. Currency code management#
movedata__CurrencyCodeComponentvalidates currency codes- The flow only sets CurrencyIsoCode when valid currency is determined using
movedata__SetValueComponent
6. Logging and tracking#
- Logs currency determination steps
- Documents price book entry operations
- Tracks created/updated record IDs for downstream processing
- Uses
movedata__WriteToLogFlowComponentandmovedata__WriteObjectToLogComponent
Configuration requirements#
Standard Price Book setup#
- Organisation must have an active Standard Price Book
StandardPriceBookIdmust be provided to the flow- Price book must be marked as Standard and Active
- User permissions must allow price book management
Currency configuration#
- Flow handles multi-currency dynamically
- Supports fallback currency logic
- Validates currency codes before assignment
- Requires multi-currency enablement for currency field availability
Price management strategy#
- Updates only when prices differ from existing values
- Automatically creates entries for new products
- Ensures immediate availability for sales processes
- Maintains Salesforce standard price history tracking
Error handling#
Missing Standard Price Book#
- Symptom: Flow terminates with validation error
- Resolution: Verify price book exists in Setup > Products > Price Books; confirm it is marked active and standard
Currency code issues#
- Causes: Invalid codes, disabled multi-currency, validation failures
- Troubleshooting: Review logging output; verify multi-currency settings; check active currency codes
Price book entry creation failures#
- Causes: Inactive product, permission issues, invalid currency, duplicate entries
- Troubleshooting: Verify product status; check user permissions; validate price format; review detailed logs
Dependencies#
GetPriceBookEntryFlowComponent(Apex action)movedata__CurrencyCodeComponent(Apex action)movedata__SetValueComponent(Apex action)movedata__WriteToLogFlowComponent(Apex action)movedata__WriteObjectToLogComponent(Apex action)