Salesforce OMS Setup and Customization Guide
This guide describes how to configure Salesforce OMS for the B2B EDI Order Lifecycle Automation use case.
Configure Salesforce OMS
Follow the instructions in the Salesforce Order Management Implementation Guide for B2B and D2C Commerce to configure Salesforce OMS. As part of the configuration:
-
Disable the Enable Reduction Orders option in Order Settings.
-
Enable Order Management, Use Person Accounts, and High Scale Orders
-
Activate Multiple Currencies
-
Enable State and Country/Territory picklists
-
Configure either a digital wallet or credit card payment method and associate an account with it
Customize Salesforce OMS
Install the Salesforce package from the Accelerator B2B Common Resources project and verify that the configuration is correct in your Salesforce organization.
Follow these steps in Salesforce OMS after installing the package successfully:
-
Create a matching rule named
Account Interchange Code Match
in Setup > Matching Rules. EnterAccount: B2B_EDISenderCode EXACT MatchBlank = FALSE
in the Matching Criteria field. -
Create a duplicate rule named
Account Interchange Code Rule
in Setup > Duplicate Rules. SelectAccount Interchange Code Match
as the matching rule. After you save and activate the duplicate rule, open the rule in Duplicate Management > Duplicate Rules and set the order to 1 in the Reorder field, which gives the rule precedence over the standard Account object matching rule.
Follow these steps in Salesforce OMS after installing the package successfully:
-
Create a matching rule named
Account Interchange Code Match
in Setup > Matching Rules. EnterAccount: B2B_EDISenderCode EXACT MatchBlank = FALSE
in the Matching Criteria field. -
Create a duplicate rule named
Account Interchange Code Rule
in Setup > Duplicate Rules. SelectAccount Interchange Code Match
as the matching rule. After you save and activate the duplicate rule, open the rule in Duplicate Management > Duplicate Rules and set the order to 1 in the Reorder field, which gives the rule precedence over the standard Account object matching rule.
Custom Fields
Verify that the following fields have been created in the corresponding objects:
Salesforce Object | Field Label | Field Name | Data Type | Length | Unique | ExternalId |
---|---|---|---|---|---|---|
Account |
B2B EDI Sender Code |
B2B_EDISenderCode__c |
Text(Case Sensitive) |
15 |
Y |
N |
Account |
B2B Order Currency |
B2B_OrderCurrency__c |
Text |
3 |
N |
N |
Account |
B2B Order Delivery Method |
B2B_OrderDeliveryMethod__c |
Lookup(Order Delivery Method) |
N |
||
Account |
B2B Order Sales Channel |
B2B_OrderSalesChannel__c |
Lookup(Sales Channel) |
N |
||
Account |
B2B Order Store |
B2B_OrderStore__c |
Lookup(Store) |
N |
||
Shipment |
ExternalId |
ExternalId__c |
Text |
100 |
N |
Y |
You must add the Read and Write permissions to the custom fields created by the Salesforce package. |
Verify the Custom Object Tab
Verify that your Salesforce org shows the Pending Order Summary Errors custom tab.
Salesforce Object | Field Label | Field Name | Data Type | Length | Unique | ExternalId |
---|---|---|---|---|---|---|
Pending Order Summary Error |
Error Code |
Error_Code__c |
Text |
255 |
N |
N |
Pending Order Summary Error |
Error Message |
Error_Message__c |
Long Text Area |
5000 |
N |
N |
Pending Order Summary Error |
Event Uuid |
Event_Uuid__c |
Text |
255 |
N |
N |
Pending Order Summary Error |
External Reference Identifier |
External_Reference_Identifier__c |
Text |
255 |
N |
N |
Pending Order Summary Error |
Pending Order Summary Error Name |
Name |
Text |
80 |
N |
N |
Platform Event
Verify that the ShipmentCreated
platform event is configured exactly as shown in the following table:
Name | API Name | Event Type | Publish Behavior |
---|---|---|---|
ShipmentCreated |
ShipmentCreated__e |
High Volume |
Publish After Commit |
In addition, verify that the following fields have been created in the ShipmentCreated
object:
Field Label | Field Name | Data Type | Length | Unique | ExternalId |
---|---|---|---|---|---|
OrderSummaryId |
OrderSummaryId__c |
Text |
50 |
N |
N |
ShipmentId |
ShipmentId__c |
Text |
50 |
N |
N |
Flows
After installing the Salesforce package, verify that the following flows are available and activated. Customize the flows based on your business requirements.
-
OMS_Create_OrderSummaryRoutingSchedule_on_OrderSummary_event
- Creates an Order Summary Routing schedule when OMS Order Summary record is created. -
OMS_Create_Fulfillment_Orders_on_OrderSummaryRoutingSchedule
- Creates a fulfillment orders after anOrder Summary Routing
schedule record is created. -
OMS_Create_Fulfillment_Orders_from_Order_Summary_Subflow
- Used inOMS_Create_Fulfillment_Orders_on_OrderSummaryRoutingSchedule
flow to create fulfillment orders for an order summary. -
OMS_Raise_ShipmentCreated_Event
flow - Creates a platform event when a shipment is created in Salesforce OMS. -
OMS_Create_Invoice
- Creates an invoice after the fulfillment order is filled. -
OMS_Log_Pending_Order_Summary_Error
- Creates an error record in thePending Order Summary Error
object when an error occurs during processing of thePending Order Summary Processed Event
.
Configure Payment Gateway
If you don’t use Salesforce Payments, configure a payment gateway manually to view and manage payments in Order Management. Configure a gateway for each payment provider, including Stripe, PayPal, Adyen, and Cybersource. You can find payment packages on AppExchange for some vendors.
Follow these steps to configure a payment gateway manually:
-
Follow the Core Payments Reference Gateway Integration Adapters instructions to create a payment gateway adapter class that uses the Salesforce APEX connector framework.
-
Create a payment gateway provider record that points to your newly created payment gateway adapter class.
-
Go to Setup and define a named credential that contains the gateway provider’s authentication and login information. The adapter class callout definition calls the named credential.
-
Create a payment gateway record to link the payment gateway provider record and the named credential.
Error Handling in Salesforce OMS
The Salesforce High Scale Orders API initially records data for order summaries as PendingOrderSummary
. To troubleshoot errors that occur during the transition from PendingOrderSummary
to Order Summary
, use the OMS_Log_Pending_Order_Summary_Error.flow
process, which subscribes to the PendingOrderSumProcEvent
event and logs errors in the Pending Order Summary Error
object. The Pending Order Summary Errors custom tab in Salesforce OMS shows the errors.
Configure Your Connected App for Authentication
Follow these steps to generate the Consumer Key and Consumer Secret values required for Salesforce authentication:
-
In your Salesforce org, navigate to New Connected App in the App Manager.
-
Enter "MuleSoft Accelerator" as the connected app name and API name.
-
Enter your email address.
-
Check the Enable OAuth Settings.
-
Set the callback URL http://localhost.
-
Select "Full access (full)" in the Selected OAuth Scopes list.
-
Click Save, and then click Continue.
-
Click Manage to view the connected app details.
-
Click Edit Policies.
-
Select All users may self-authorize in the OAuth Policies section.
-
Select Relax IP restrictions in the IP Relaxation field.
-
Click Save.
-
Go to Setup and navigate to App Manager.
-
Select View from the actions for your connected app.
-
Click Manage Consumer Details in the API (Enable OAuth Settings) section.
-
Verify your identity by entering the verification code from your email.
-
Copy the values in the Consumer Key and Consumer Secret fields.
-
Add the values as the
sfdc.client-id
andsfdc.client-secret
properties respectively in your Maven settings.xml file.
Use the sample settings.xml file in the Accelerator B2B Common Resources project as a starting point for configuring your connected app.
Generate a Security Token for Your Service Account
To connect to the Salesforce OMS Cloud instance, you must generate a token for the service account used by Mule applications.
-
Log in to Salesforce as the service account user, which is the account Mule applications use to connect to Salesforce.
-
Click the Username icon and select Settings.
-
Select Reset My Security Token in My Personal Information.
-
Click Reset Security Token.
Salesfoce emails the new security token to the service account user’s address.
The option to reset your security token does not show if you have one or more login IP ranges. To enable the option, remove the login IP ranges from the settings page of the profile assigned to the service account user. Reset your security token, and then restore the login IP ranges. |