Message Image  

Introducing support for Salesforce Commerce Cloud

 View Only
Fri July 03, 2020 07:20 AM

We’ve added Salesforce Commerce Cloud Digital Data – a product line of Salesforce Commerce Cloud – to our growing list of applications in the App Connect catalog. Salesforce Commerce Cloud is an enterprise cloud-based solution that offers unified and personalized customer experiences across all points of commerce. Salesforce Commerce Cloud Digital Data provides the resources for developing e-commerce sites in your realm.

App Connect accesses the Salesforce Commerce Cloud resources via the Open Commerce API (OCAPI), which includes a Shop API and a Data API. The events and actions provided for Salesforce Commerce Cloud Digital Data in App Connect enable interaction with the Data API module of the OCAPI.

Connecting to Salesforce Commerce Cloud Digital Data

To use Salesforce Commerce Cloud Digital Data in your App Connect flows, you’ll need to connect App Connect to your Salesforce Commerce Cloud account by providing a set of connection details; for example:

You can connect either from the Applications tab on the App Connect Catalog page, or when you add the app to a flow.

  • Base URL: The base URL (or protocol and hostname) of your Salesforce Commerce Cloud instance. For example, if the URL of your instance is https://mysite.demandware.net/on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage, specify the base URL as https://mysite.demandware.net. This value is also typically shown as a Business Manager hostname under Administration > Sites > Manage Sites > Business Manager > Hostnames.
 
  • Example: Locating the hostname


  • Client ID: The client ID for the Open Commerce API. You might need to work with your Salesforce Commerce Cloud account administrator to generate this value by adding an OCAPI client. For more information, see Add a Client ID for the Open Commerce API (requires login to the demandware.com domain).

    If you are using a sandbox or test environment, you might be able to use a demo client ID value of aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.

  • Client secret: Work with your Salesforce Commerce Cloud account administrator to obtain a client secret for the OCAPI client that was added.

Scenario

There are multiple use cases for integrating Salesforce Commerce Cloud Digital Data with other applications and utilities in the App Connect catalog. In this blog, we are going to illustrate a data sync scenario where a scheduled flow runs once a day to retrieve new product records that were added to an IBM Db2 database, and then creates corresponding products in Salesforce Commerce Cloud.

The event-driven flow will be configured to:

  1. Run once every 24 hours.
  2. Set a variable to identify the current date.
  3. Reference that variable in a batch process to retrieve new product records that were added to the database during the 24-hour period.
  4. Pass the contents retrieved from the database to a JSON parser for parsing into a suitable schema.
  5. Create a product record in Salesforce Commerce Cloud for each parsed Db2 record.

To begin, we’ll access the Toolbox to add a Scheduler as the first node, and then schedule the flow to trigger every 24 hours.


Next, we’ll add a Set variable node from the Toolbox so that we can define a variable (named todays_date) and set its value to the current date. We’ll define the value by using the JSONata expression {{$substring($now(), 0, 10)}}, which returns the first 10 characters of the current UTC timestamp in ISO 8601 string format; for example 2018-07-23. We’ll use this variable later in the flow.


Now, let’s add a Batch process node from the Toolbox. We’ll include a number of actions in the batch process, starting with an IBM Db2 retrieve action.


After selecting IBM Db2 (and connecting if necessary), we can click Show More to choose the table whose data we want to sync with Salesforce Commerce Cloud, and the corresponding action that retrieves records from that table.


We want to retrieve product records that were created “today”. So we’ll add a condition that filters for product records whose created date in Db2 is equal to the todays_date variable that was defined earlier in the Set variable node. (We can optionally specify the maximum number of records to be retrieved by selecting the Specify maximum number of items to retrieve check box and then setting a value.)


Because the product records are retrieved as a JSON string, we’ll need to convert the string into a JSON object to make the data accessible for mapping to Salesforce Commerce Cloud later in the flow. We can do so by inserting a JSON parser node from the Toolbox. In the JSON Input field, we’ll indicate that we want to parse the content returned by the Db2 retrieve action. Then, in the Example JSON field, we’ll paste some sample JSON of the retrieved records and use it to generate the required JSON schema.


Finally, let’s add a Create product action for Salesforce Commerce Cloud Digital Data.


And then map the ID and the Owning catalog ID fields to the parsed database data from the JSON parser.


Our flow is ready to go!



When the flow is triggered each day, we should be able to see the new product records in Salesforce Commerce Cloud that were created from the retrieved product records in Db2.

If you’d like to try out this scenario, you can sign up here and get started in minutes. The flow definition file (BatchExtractProductDataFromDB2AndInsertIntoSFCC.zip)  is attached for you to import and use as a template.

You can also access this flow directly from the template gallery in the App Connect UI.

We’d also love to hear from you. Why not share some of your use cases with us or send us any other comments?




Attachment(s)
zip file
BatchExtractProductDataFromDB2AndInsertIntoSFCC.zip   1 KB   1 version
Uploaded - Fri July 03, 2020