- Overview
- Authentication Setup
- Sync Settings
- App Settings
- Sync Salesforce Orders Settings
- Sync Store Orders Settings
- Sync Salesforce Contact Settings
- Sync Store Customers Settings
- Sync Store Products Settings
Overview
Salesforce has one of the leading customer relationship management (CRM) platforms. This integration helps syncing Products, Accounts, Contacts, Customers, and Orders between Storefront and Salesforce.
Setup Salesforce Account:
Authentication Setup
OAuth 2.0 Client Credentials Flow for Server-to-Server Integration
- Create your connected app and complete its basic information.
- From Settings menu, click Setup
- From Setup menu, expand Apps, and click App Manager
- Select “New Connected App”
- Enter required information
- Note: Callback URL is required, but the sample URL provided is not valid. Use provided sample URL to save the connected app.
- From Settings menu, click Setup
- Configure the necessary OAuth settings for the connected app.
- Enable the client credentials flow for your connected app.
- From Setup, in the Quick Find box, enter Apps, and then select App Manager.
- Find your connected app, click, and then select Edit.
- Under API (Enable OAuth Settings), select Enable Client Credentials Flow.
- Enable Client Credentials Flow, with Manage user data via APIs (api) scope.
- When you understand the security risks, accept the warning.
- Save your changes.
- After saving changes, from the newly created Connected App, click on Manage Consumer Details.
- This will open a new window with “Consumer Key” and “Consumer Secret”.
- Copy both values for configuring the Salesforce Integration App in Storefront.
- This will open a new window with “Consumer Key” and “Consumer Secret”.
- Select an execution user for the flow.
- Although there’s no user interaction in the client credentials flow, Salesforce still requires you to specify an execution user. By selecting an execution user, you allow Salesforce to return access tokens on behalf of this user.
- From the connected app detail page, click Manage.
- Click Edit Policies.
- Under Client Credentials Flow, for Run As, click, and find the user that you want to assign the client credentials flow. The execution user must have the API Only permission.
- Create a User with Profile associated that has API Only permission, e.g. “Salesforce API Only System Integrations”.
- This profile has API Only permission:
- Note: Make sure the user has appropriate Permission Set associated to read and modify objects e.g. Accounts, Orders, Customers, etc…
- Example permission set with Object settings to read and modify Accounts.
- Save your changes.
Sync Settings
Next, you will need to enable Salesforce within your store's admin dashboard. You can find this in Tools > Apps & Addons > Salesforce:
App Settings
Consumer Key & Consumer Secret: Use Consumer Key & Consumer Key for your Salesforce account as generated during “Authentication Setup”.
Salesforce Domain URL: Provide your Salesforce Domain URL.
- To get the Salesforce Domain URL to use as a base URL for API requests, go to the Setup screen, then click on Settings → Company Settings and select My Domain:
Sync Interval: You can choose to run sync manually or automatically sync data on a selected interval between Storefront and Salesforce.
Sync Salesforce Orders Settings
Sync Salesforce Orders to Store: Use this to enable/disable syncing of Orders from Salesforce to Storefront.
Salesforce to Store - New Order Status: Select the status of Orders to be set for new orders imported from Salesforce.
Sync Store Orders Settings
Sync Store Orders to Salesforce: Use this to enable/disable syncing of Orders from Storefront to Salesforce.
Salesforce Order Pricebook Name: Use this to specify the default Pricebook Name to be used while creating new orders in Salesforce.
Sync Orders After Order ID: Any orders proceeding the number specified will not be synced. This is needed if you do not wish to sync any legacy orders.
Sync Store Order Shipments to Salesforce (SysAdmin Only): Use this to enable/disable syncing of Storefront Order Shipments to Salesforce.
Store to Salesforce - Order Statuses Mapping: Use this to Specify the Order Statuses Mapping to be used for syncing Order status from Store to Salesforce
Sync Store Order Returns: To enable/disable syncing of Store Order returns. This creates an order with negative quantity of order items.
Note: To enable Syncing of Order Returns, make sure your Order Setup in Salesforce allows creation of Orders with Negative Quantity:
Salesforce New Return Order Status: Specify the Order Status to be set in Salesforce for new Return Order.
Note: In cases where a Return order is created with a Partial Return and the status of the Return Order is set as “Activated” in Salesforce, if additional returns are added for the same order on Storefront, it will be logged as an error on subsequent syncs. The error will look like: { Unable to modify activated Order: cannot delete Order, or add or remove Order Products }. This is a limitation of Salesforce that prevents users from modifying Order Products once an order is activated. To work around this, set the “Salesforce New Return Order Status” setting value to “Draft” and do not change the status of return orders in Salesforce. |
Sync Order Cases Status from Salesforce: To enable/disable syncing of Order Cases from Salesforce. Order related cases status is synced to an Order Custom Field
Store to Salesforce Order - Additional Mapping: Provide additional custom mapping to send data over to Salesforce. This will be used while Syncing Orders from Store.
Note: This is used to specify additional mapping when Syncing Orders from Storefront to Salesforce. “Field Name” is used to specify the Salesforce field name and can contain any Standard or Custom Field Name for the object. “Mapped Value” is any hardcoded value or Merge Code for the object in context. For example, in the above screenshot, the application would try to populate the Tax_Amount__c Salesforce Order field by getting the value for the ##ORDERTAX## merge code. |
Store to Salesforce Order Item - Additional Mapping: Provide additional custom mapping to send data over to Salesforce while Syncing Order Items from Store.
Sync Salesforce Contacts Settings
Sync Contacts from Salesforce: To toggle syncing of Contacts from Salesforce to Storefront.
Sync Store Customers Settings
Store to Salesforce Contact - Additional Mapping: Provide additional custom mapping to send data over to Salesforce. This will be used while Syncing Contacts from Store.
Store to Salesforce Account - Additional Mapping: Provide additional custom mapping to send data over to Salesforce. This will be used while Syncing Accounts from Store.
Sync Store Products Settings
Store to Salesforce Product - Additional Mapping: Provide additional custom mapping to send data over to Salesforce. This will be used while Syncing Products from Store.