Thursday, July 1, 2021

#864 - OIC --> Oracle Commerce Cloud syncing Products with SFDC


I had a request from a customer this week regarding Oracle Commerce Cloud / SFDC integration. This gave me an opportunity to try out OIC support for Commerce Cloud. The usual caveat to begin with - I am not an Oracle Commerce Cloud expert, however, my shop was up and running very quickly, because OCC is so intuitive.

Now to connecting to OCC from OIC - 

There are some pre-reqs for creating the Oracle Commerce Cloud connection in OIC - you need the Commerce admin url and a security token. The latter requires one to register an application - I called mine OIC.



























Back in OIC - let's create that commerce Cloud connection - 

connection base url format is as follows -
https://yourOCC-admin.occa.ocs.oraclecloud.com/ccadmin/v1/

Security Token: yourApplicationKey













Now to a basic test - retrieve products, ok, I have only one - the Hare of the Dog t-shirt, handcrafted in Weimar, by that bunch of Nietzschean scholars, in between bouts of reading Ecce Homo.

I create a Scheduled Orchestration - 




















GetProducts leverages the Commerce Cloud connection and is configured as follows -



















I activate and test - 























So now to a simple product sync example with SFDC.

I have the following Products in SFDC - 
















Two great products there -Hare of the Dog Keyring and Flag. - Let's sync with Commerce Cloud.

The basic integration is as follows (by basic, I mean no error handling etc.) -


 






















I use SOQL to get the Products from SFDC and then leverage the Commerce Cloud connection to do the product inserts. More details later.

Here is the Activity Stream from my test -

























I check out the products in Commerce Cloud - 













So first to the SFDC invoke - 
























Here is the SOQL - 
SELECT id, Product2.Id, Product2.Name, Pricebook2.Id, Pricebook2.Name,  UnitPrice FROM PricebookEntry  WHERE Pricebook2.Name = '&pricebook'

I enter a valid pricebook value and click Test My Query -



















I only select a couple of fields, usually you will want to select more. SFDC field names can be found under Setup - Object Manager


 


Now to the Commerce Cloud Invoke - 



















Note the following: Create Product. Creates a new product. **Requires the x-ccasset-language header so translated content can be set for a specific language.**

Here is the mapping - firstly the header, which I set to en.











The screenshots below only shows the mapped fields.















Very simple!

Naturally, one needs to add error handling to the integration flow, also, one would probably want to update the SFDC Product object with the product id from Commerce Cloud and visa-versa. I have covered SFDC custom field creation in previous posts. For Commerce Cloud, it looks like these fields need to be added via a call to the OCC REST api. One would also check for pre-existence etc.

Here is the new custom field in the SFDC Product object - 













I add logic to the integration to update the Product with the relevant Commerce Cloud Product id - 





 



















Here is the configuration of UpdateSFDCProduct -





















Mapping - only showing mapped fields - 




 
The result - 



No comments: