Skip to content
Last updated

Salesforce Commerce Cloud Export Integration

Salesforce Commerce Cloud (SFCC) is an e-commerce solution for B2C (business to consumer) and B2B (business to business) customers. This connector helps to

  • Synchronize customer profiles on TD Console to the Customer Lists on the SFCC platform.
  • ​Assign customers to or remove customers from the static Customer Groups on the SFCC platform.

Prerequisites

  • Basic Knowledge of Treasure Data
  • Basic knowledge of Salesforce Commerce Cloud
  • Basic knowledge of Open Commerce Cloud API
  • Have an API Client created on the Commerce Cloud Account Manager System. Further details can be found here

Limitations

  • The application secret should not contain the %  character. Due to an internal issue with the SFCC authentication server, any secret containing the % character is not able to authenticate.
  • The connector will send the customer attributes as-is without validating them. Data validation is on the SFCC side.
  • To synchronize customer profiles to the SFCC Customer List, the list must exist on SFCC before the job execution.
  • A large volume of data may cause low performance.

Use the TD Console

Create a New Connection

You must create and configure the data connection on TD Console before running your query. As part of the data connection, you provide authentication to access the integration following the below steps

  1. Open TD Console
  2. Navigate to Integrations Hub > Catalog
  3. Search for and select Salesforce Commerce Cloud
  4. Select Create Authentication, and provide the credential information for the integration as described below
  5. Select **Continue,**enter a name for the Authentication, and select Done.

Authentication Fields

FieldDescription
API Client IDThe API Client ID is generated by following the Create and configure an API Client procedure
API Client PasswordThe password of the API Client
Base URIURL for accessing your Business Manager Application. Example value:  https://xxxx.commercecloud.salesforce.com/

Configure a Query Result for Export

The TD Console supports multiple ways to export data. Please follow the below steps to export data from the Data Workbench.

  1. Navigate to Data Workbench > Queries.
  2. Select New Query, and define your query.
  3. Select Export Results to configure the data exporting.
  4. Select an existing SFCC authentication or create a new one following the above section.
  5. Configure the exporting parameters as described below, and select Done.
  • Configuration Parameters
Field Description
Data target
  • Select Customer List to manipulate customer profiles on the target platform, including creating new customer profiles, updating profiles, and deleting profiles. - Select Customer Group to assign customers to or remove customers from the specific static Customer Groups.
Operation mode​With the Customer List data target, select one of the supported operating modes that follow:
  • Create: create new customer profiles. - Update: Update the customer profile attributes determined in the customer_no column.
  • Upsert: Overwrite the customer profiles determined in the customer_no column. If they don't exist, new profiles are created. - Delete: Delete customer profiles determined in the customer_no column. With the Customer Group data target, select one of the support operating modes that follow:
  • Add: Assign customers determined in the customer_no column to the specific Customer Group.
  • Remove: Un-assign customers determined in the customer_no column from the specific Customer Group. - Replace: The specified Customer Group will be deleted, and then a new one will be created with the same ID and customer profiles added.
Customer list IDRequired in case of the Customer List data target. The ID of a predefined Customer List needs to be provided. Otherwise, the query result must include a column named customer_list_id.
Skip empty/null fields(Applied only for the Customer List data target) When unchecked, empty, or null, attributes (columns) will be sent to SFCC. Consequently, those attributes on SFCC will be cleared (be overwritten by an empty value). The default is checked, in which attributes that are empty or null will not be sent to SFCC.
Site IDRequired in case of the Customer Group data target. The ID of the site the target Customer Group belongs.
Customer group IDRequired in case of the Customer Group data target. The ID of a static Customer Group. If not exist, a new one will be created
Customer group name(Optional. Applied only for the Customer Group data target.) The group name will be used in case the specified Customer Group doesn't exist.
Thread countThe number of concurrent upload jobs ranges from 2 to 40.

Customer attribute overwriting of the Customer List data target

  • Use Update mode to update some selected attributes of the existing customer profiles. If Skip empty/null fields is checked, empty or null attributes will not be exported, and the existing values on SFCC will stay unchanged.
  • Use Upsert mode when you want to overwrite all attributes. This means that the existing customer profiles will be replaced by those included in the query result, and attributes that are not included will be emptied. Profiles that do not exist will be created anew. |

Define your query to synchronize customer profiles to the Customer Lists

  • Your query must include the customer_no column to indicate which customer profiles are synchronized.
  • If the query intention is to update multiple Customer Lists, a column named customer_list_id can be included to indicate the target lists
  • For other customer attributes, please refer to the SFCC documentation. All attributes will be sent as-is without any validation
ColumnDescriptionMandatory
customer_list_idIf it is not empty/null, it defines the ID of the Customer List, where the customer attributes on the row will be updated. Otherwise, the Customer List filled in the Configuration screen will be taken into account.Optional
customer_noSFCC Customer Number. it is not required in the Create mode.Required
CredentialsCredential information is required in the Create mode. Please refer here for more details.Optional
Customer attributesRefer here for the list of supported attributes.Optional
Customer addressRefer here for the list of supported attributes.Optional

Define your Query to Assign/Remove Customers to Customer Groups

To assign (or remove) customers to (from) a Customer Group, the only required column in your query is the customer_no column.

(Optional) Schedule Query Export Jobs

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.

Treasure Data's scheduler feature supports periodic query execution to achieve high availability.

When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored.

For example, if the cron schedule is '0 0 1 * 1', then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed.

Scheduling your Job Using TD Console

  1. Navigate to Data Workbench > Queries

  2. Create a new query or select an existing query.

  3. Next to Schedule, select None.

  4. In the drop-down, select one of the following schedule options:

    Drop-down ValueDescription
    Custom cron...Review Custom cron... details.
    @daily (midnight)Run once a day at midnight (00:00 am) in the specified time zone.
    @hourly (:00)Run every hour at 00 minutes.
    NoneNo schedule.

Custom cron... Details

Cron ValueDescription
0 * * * *Run once an hour.
0 0 * * *Run once a day at midnight.
0 0 1 * *Run once a month at midnight on the morning of the first day of the month.
""Create a job that has no scheduled run time.
 *    *    *    *    *
 -    -    -    -    -
 |    |    |    |    |
 |    |    |    |    +----- day of week (0 - 6) (Sunday=0)
 |    |    |    +---------- month (1 - 12)
 |    |    +--------------- day of month (1 - 31)
 |    +-------------------- hour (0 - 23)
 +------------------------- min (0 - 59)

The following named entries can be used:

  • Day of Week: sun, mon, tue, wed, thu, fri, sat.
  • Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.

A single space is required between each field. The values for each field can be composed of:

Field ValueExampleExample Description
A single value, within the limits displayed above for each field.
A wildcard '*' to indicate no restriction based on the field.'0 0 1 * *'Configures the schedule to run at midnight (00:00) on the first day of each month.
A range '2-5', indicating the range of accepted values for the field.'0 0 1-10 * *'Configures the schedule to run at midnight (00:00) on the first 10 days of each month.
A list of comma-separated values '2,3,4,5', indicating the list of accepted values for the field.0 0 1,11,21 * *'Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month.
A periodicity indicator '*/5' to express how often based on the field's valid range of values a schedule is allowed to run.'30 */2 1 * *'Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. '0 0 */5 * *' configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month.
A comma-separated list of any of the above except the '*' wildcard is also supported '2,*/5,8-10'.'0 0 5,*/10,25 * *'Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month.
  1. (Optional) You can delay the start time of a query by enabling the Delay execution.

Execute the Query

Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination.

Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.

(Optional) You can delay the start time of a query by enabling the Delay execution.

Activate a Segment in Audience Studio

You can also send segment data to the target platform by creating an activation in the Audience Studio.

  1. Navigate to Audience Studio.
  2. Select a parent segment.
  3. Open the target segment, right-mouse click, and then select Create Activation.
  4. In the Details panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters.
  5. Customize the activation output in the Output Mapping panel.

  • Attribute Columns
    • Select Export All Columns to export all columns without making any changes.
    • Select + Add Columns to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select + Add Columnsto add new columns for your activation output.
  • String Builder
    • + Add string to create strings for export. Select from the following values:
      • String: Choose any value; use text to create a custom value.
      • Timestamp: The date and time of the export.
      • Segment Id: The segment ID number.
      • Segment Name: The segment name.
      • Audience Id: The parent segment number.
  1. Set a Schedule.

  • Select the values to define your schedule and optionally include email notifications.
  1. Select Create.

If you need to create an activation for a batch journey, review Creating a Batch Journey Activation.

(Optional) Export Integration Using the CLI

The TD Toolbelt can trigger the Query Result exporting from a CLI. You need to specify the parameters for the exporting job as the --result option of the td query command. For more information, please refer to this article.

The format of the option is JSON and the general structure is as follows.

  • Case: data_target is customer_list
{"type": "salesforce_commerce_cloud",    "client_id": "client_id",    "client_secret": "client_secret",    "base_url": "https://your link.commercecloud.salesforce.com",    "data_target": "customer_list",    "operation_mode": "create,update,delete,upsert",    "customer_list_id": "customer_list_id",    "skip_empty_fields": true,    "thread_count": 2}Case: data_target is customer_group{    "type": "salesforce_commerce_cloud",    "client_id": "client_id",    "client_secret": "client_secret",    "base_url": "https://your link.commercecloud.salesforce.com",    "data_target": "customer_list",    "customer_group_operation_mode": "add,remove,replace",    "site_id": "your site id",    "customer_group_id": "your customer group id",    "customer_group_name": "your customer group name",    "thread_count": 2}

CLI Parameters

Name Description Value Default Value Required
data_targetRef data_target in Configuration Parameters sectionList of options:
  1. customer_list
  2. customer_group
customer_groupYES
td_authentication_idThis is the id of the exsiting SFCC authentication on TD console. PS: when using td_authentication_id, we don't need to declare the client_id & client_secret. Because TD system will get those info by td_authentication_idNumbernullNO
client_idThe client_id that get from SFCC. PS: TD system will ignore this value when td_authentication_id is null.StringnullYES (when td_authentication_id is null)
client_secretThe client_secret that get from SFCC. PS: TD system will ignore this value when td_authentication_id is null.StringnullYES (when td_authentication_id is null)
base_urlRef base_url in Configuration Parameters sectionStringnullYES
operation_modeRef operation_mode in Configuration Parameters section. The operation_mode only use when the data_target is customer_list.Options:
  1. customer_list
  2. customer_group
customer_listYES (when data_target is customer_list)
customer_list_idRef customer_list_id in Configuration Parameters section. The operation_mode only use when the data_target is customer_list.StringnullYES (when data_target is customer_list)
skip_empty_fieldsThe indicator flag that help the connector decide to ignore the fields that have value are empty or null.BooleantrueNO
customer_group_operation_modeThe operation_mode only use when the data_target is customer_group. Which action will be apply for customer_group.Options:
  1. add: Assign the customer_no to a specific customer_group_id.
  2. remove: remove the customer_no to a specific customer_group_id.
  3. replace: remove all the members in a specific group and assign the customer_no to that list.
AddYES (when data_target is customer_group)
site_idRef site_id in Configuration Parameters section.StringnullYES (when data_target is customer_group)
customer_group_idRef customer_group_id in Configuration Parameters section.StringnullYES (when data_target is customer_group)
customer_group_nameRef customer_group_name in Configuration Parameters section.StringemptyNO

Example usage

  • Create the new customer
td --database luan_db --wait "SELECT customer_list_id,first_name,last_name,birthday,company_name,email,fax,gender,job_title,phone_business,phone_home,phone_mobile,second_name,credentials FROM (VALUES ('site_1','fname_201','lname_1','1990-05-12','Test Company','test201@test.com','84111111201',1,'Sr Software','84111111201','84111111201','84111111201','Ryan','{\"enabled\":true,\"locked\":false,\"login\":\"login_url_1_100001.csv\"}')) tbl(customer_list_id,first_name,last_name,birthday,company_name,email,fax,gender,job_title,phone_business,phone_home,phone_mobile,second_name,credentials)" \--type presto \--result '{"type":"salesforce_commerce_cloud","td_authentication_id": 2837,"base_url":"https://zzvt-003.dx.commercecloud.salesforce.com","operation_mode":"create","customer_list_id":"static_g_1","skip_invalid_record":true,"thread_count":2}'
  • Update the existing customer
td --database luan_db --wait "SELECT customer_list_id,customer_no,first_name,last_name,credentials FROM (VALUES ('site_1','00000001','fname_1_updated','','{\"enabled\":true,\"locked\":false,\"login\":\"login_url_1_100001.csv\"}')) tbl(customer_list_id,customer_no,first_name,last_name,credentials)" \--type presto \--result '{"type":"salesforce_commerce_cloud","data_target": "customer_list","td_authentication_id": 2837,"base_url":"https://zzvt-003.dx.commercecloud.salesforce.com","operation_mode":"update","customer_list_id":"static_g_1","skip_invalid_record":true,"thread_count":2}'
  • Assign customer to a specific customer group
td --database luan_db --wait "SELECT customer_no FROM (VALUES ('00000001')) tbl(customer_no)" \--type presto \--result '{"type":"salesforce_commerce_cloud","data_target": "customer_group","td_authentication_id": 2837,"base_url":"https://zzvt-003.dx.commercecloud.salesforce.com","customer_group_operation_mode":"add","site_id":"site_1", "customer_group_id": "static_customer_group_1","thread_count":2}'

(Reference) Create and configure an API Client

This section explains at a high level how to obtain credentials and configure necessary permissions (if any) to use the SFCC API. The detailed steps might be changed by Salesforce without any in-advance notice.

Create an API Client on the SFCC Account Manager System

  1. Navigate and log in to the SFCC Account Manager
  2. Select API Client

  1. Select Add API Client

  1. Type values for Display Name, Password, Confirm Password, and select Access Control to enable it
  2. In the Organizations area, select your organization
  3. In the Roles area, select Add
  4. Select the appropriate roles, and select Add
  5. Scroll to the Token Endpoint Auth Method section
  6. Select the Auth method and the token format like the one below, and select Save

  1. Note down the API Client ID and Password to create a new Authentication for the SFCC integration on the TD Console

Configure the API Client to access your SFCC instance

These steps allow the created API Client to modify data on your SFCC instance using the Open Commerce API features

  1. Open Business Manager (https://{YOUR_INSTANCE_URL}.commercecloud.salesforce.com/on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage)
  2. Select Administration >> Open Commerce API Settings

  1. Select Data in the Select Type drop-down list

  1. On the configuration string of the Data API, make sure the WRITE permission is set: "write_attributes": "(**)"
  2. Select  Global (organization-wide) in the Select Context drop-down list
  3. Select Save, and the permission of the API Client will be applied in a few minutes

Your API Client is ready to be used in the Salesforce Commerce Cloud integration