---
schema_version: "1"
id: 6b908461ae9e6519e1d643a7c72a85fb5a721e36817dff00a3c2b59b5185614b
title: Salesforce OMS Setup and Customization Guide
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/salesforce-oms/latest/sfdc-oms-setup-customization-guide.md
canonical_url: https://docs.mulesoft.com/salesforce-oms/latest/sfdc-oms-setup-customization-guide
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a6f835b6f9af28b1b0b0839a9b67be228c7d696f8a750f687d3c2c949e7777a4
description: MuleSoft Documentation Site
release: "1.1"
latest: true
---
---
product: Salesforce OMS
version: 1.1
is-latest-version: true
---

# Salesforce OMS Setup and Customization Guide

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

This guide describes how to configure Salesforce OMS for the
[B2B EDI Order Lifecycle Automation](https://anypoint.mulesoft.com/exchange/org.mule.examples/mulesoft-accelerator-for-salesforce-oms/)
use case.

## Configure Salesforce OMS

Follow the instructions in the
[Salesforce Order Management Implementation Guide for B2B and D2C Commerce](https://help.salesforce.com/s/articleView?language=en_US&id=commerce.om_impl_intro.htm&type=5)
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 Payment Gateway](#configure_payment_gateway)

- 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](https://anypoint.mulesoft.com/exchange/org.mule.examples/accel-b2b-common-resources-src/)
project and verify that the configuration is correct in your Salesforce organization.

Follow these steps in Salesforce OMS after installing the package successfully:

1.  Create a matching rule named `Account Interchange Code Match` in **Setup > Matching Rules**.
    Enter `Account: B2B_EDISenderCode EXACT MatchBlank = FALSE` in the **Matching Criteria** field.

2.  Create a duplicate rule named `Account Interchange Code Rule` in **Setup > Duplicate Rules**.
    Select `Account 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:

<table><colgroup><col> <col> <col> <col> <col> <col> <col></colgroup><thead><tr><th><strong>Salesforce Object</strong></th><th><strong>Field Label</strong></th><th><strong>Field Name</strong></th><th><strong>Data Type</strong></th><th><strong>Length</strong></th><th><strong>Unique</strong></th><th><strong>ExternalId</strong></th></tr></thead><tbody><tr><td><p>Account</p></td><td><p>B2B EDI Sender Code</p></td><td><p>B2B_EDISenderCode__c</p></td><td><p>Text(Case Sensitive)</p></td><td><p>15</p></td><td><p>Y</p></td><td><p>N</p></td></tr><tr><td><p>Account</p></td><td><p>B2B Order Currency</p></td><td><p>B2B_OrderCurrency__c</p></td><td><p>Text</p></td><td><p>3</p></td><td><p>N</p></td><td><p>N</p></td></tr><tr><td><p>Account</p></td><td><p>B2B Order Delivery Method</p></td><td><p>B2B_OrderDeliveryMethod__c</p></td><td><p>Lookup(Order Delivery Method)</p></td><td></td><td></td><td><p>N</p></td></tr><tr><td><p>Account</p></td><td><p>B2B Order Sales Channel</p></td><td><p>B2B_OrderSalesChannel__c</p></td><td><p>Lookup(Sales Channel)</p></td><td></td><td></td><td><p>N</p></td></tr><tr><td><p>Account</p></td><td><p>B2B Order Store</p></td><td><p>B2B_OrderStore__c</p></td><td><p>Lookup(Store)</p></td><td></td><td></td><td><p>N</p></td></tr><tr><td><p>Shipment</p></td><td><p>ExternalId</p></td><td><p>ExternalId__c</p></td><td><p>Text</p></td><td><p>100</p></td><td><p>N</p></td><td><p>Y</p></td></tr></tbody></table>

> [!NOTE] 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.

<table><colgroup><col> <col> <col> <col> <col> <col> <col></colgroup><thead><tr><th><strong>Salesforce Object</strong></th><th><strong>Field Label</strong></th><th><strong>Field Name</strong></th><th><strong>Data Type</strong></th><th><strong>Length</strong></th><th><strong>Unique</strong></th><th><strong>ExternalId</strong></th></tr></thead><tbody><tr><td><p>Pending Order Summary Error</p></td><td><p>Error Code</p></td><td><p>Error_Code__c</p></td><td><p>Text</p></td><td><p>255</p></td><td><p>N</p></td><td><p>N</p></td></tr><tr><td><p>Pending Order Summary Error</p></td><td><p>Error Message</p></td><td><p>Error_Message__c</p></td><td><p>Long Text Area</p></td><td><p>5000</p></td><td><p>N</p></td><td><p>N</p></td></tr><tr><td><p>Pending Order Summary Error</p></td><td><p>Event Uuid</p></td><td><p>Event_Uuid__c</p></td><td><p>Text</p></td><td><p>255</p></td><td><p>N</p></td><td><p>N</p></td></tr><tr><td><p>Pending Order Summary Error</p></td><td><p>External Reference Identifier</p></td><td><p>External_Reference_Identifier__c</p></td><td><p>Text</p></td><td><p>255</p></td><td><p>N</p></td><td><p>N</p></td></tr><tr><td><p>Pending Order Summary Error</p></td><td><p>Pending Order Summary Error Name</p></td><td><p>Name</p></td><td><p>Text</p></td><td><p>80</p></td><td><p>N</p></td><td><p>N</p></td></tr></tbody></table>

### Platform Event

Verify that the `ShipmentCreated` platform event is configured exactly as shown in the following
table:

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Name</th><th>API Name</th><th>Event Type</th><th>Publish Behavior</th></tr></thead><tbody><tr><td><p>ShipmentCreated</p></td><td><p>ShipmentCreated__e</p></td><td><p>High Volume</p></td><td><p>Publish After Commit</p></td></tr></tbody></table>

In addition, verify that the following fields have been created in the `ShipmentCreated` object:

<table><colgroup><col> <col> <col> <col> <col> <col></colgroup><thead><tr><th><strong>Field Label</strong></th><th><strong>Field Name</strong></th><th><strong>Data Type</strong></th><th><strong>Length</strong></th><th><strong>Unique</strong></th><th><strong>ExternalId</strong></th></tr></thead><tbody><tr><td><p>OrderSummaryId</p></td><td><p>OrderSummaryId__c</p></td><td><p>Text</p></td><td><p>50</p></td><td><p>N</p></td><td><p>N</p></td></tr><tr><td><p>ShipmentId</p></td><td><p>ShipmentId__c</p></td><td><p>Text</p></td><td><p>50</p></td><td><p>N</p></td><td><p>N</p></td></tr></tbody></table>

### 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 an `Order Summary Routing` schedule record is created.

- `OMS_Create_Fulfillment_Orders_from_Order_Summary_Subflow` - Used in
  `OMS_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 the
  `Pending Order Summary Error` object when an error occurs during processing of the
  `Pending 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:

1.  Follow the
    [Core Payments Reference Gateway Integration Adapters](https://github.com/forcedotcom/Core-Payments-Reference-Gateway-Integration-Adapters)
    instructions to create a payment gateway adapter class that uses the Salesforce APEX connector
    framework.

2.  Create a payment gateway provider record that points to your newly created payment gateway
    adapter class.

3.  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.

4.  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:

1.  In your Salesforce org, navigate to **New Connected App** in the **App Manager**.

2.  Enter "MuleSoft Accelerator" as the connected app name and API name.

3.  Enter your email address.

4.  Check the **Enable OAuth Settings**.

5.  Set the callback URL `http://localhost`.

6.  Select "Full access (full)" in the **Selected OAuth Scopes** list.

7.  Click **Save**, and then click **Continue**.

8.  Click **Manage** to view the connected app details.

9.  Click **Edit Policies**.

10. Select **All users may self-authorize** in the **OAuth Policies** section.

11. Select **Relax IP** restrictions in the **IP Relaxation** field.

12. Click **Save**.

13. Go to **Setup** and navigate to **App Manager**.

14. Select **View** from the actions for your connected app.

15. Click **Manage Consumer Details** in the **API (Enable OAuth Settings)** section.

16. Verify your identity by entering the verification code from your email.

17. Copy the values in the **Consumer Key** and **Consumer Secret** fields.

18. Add the values as the `sfdc.client-id` and `sfdc.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.

1.  Log in to Salesforce as the service account user, which is the account Mule applications use to
    connect to Salesforce.

2.  Click the Username icon and select **Settings**.

3.  Select **Reset My Security Token** in **My Personal Information**.

4.  Click **Reset Security Token**.

Salesfoce emails the new security token to the service account user’s address.

> [!NOTE] 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.

## See Also

- [Prerequisites](https://docs.mulesoft.com/salesforce-oms/latest/prerequisites)

- [MuleSoft Accelerator for Salesforce OMS](https://docs.mulesoft.com/salesforce-oms/latest/)
