Akshay Sura - Partner
10 Sep 2020
In this video I am going to go through how we tried to solve the issue of updating products from Sitecore Content Hub Product Content Management (PCM) into Sitecore Commerce. This same method can be used to sync products to Sitecore XP and other channels.
Note: The following is the transcription of the video produced by an automated transcription system.
Hey, guys, this is Akshay Sura today we’ll be talking about syncing your products from content hub PCM product content management into Sitecore Commerce or Sitecore XP, you know, whichever systems you have. So, we talked about this before integrating to Sitecore XP or XC from PCM. There’s currently no connecter available for you to do that. You would have to do that all by hand or customization, essentially what it is. Right. So, you’re dealing with M.PCM.Product and M.PCM. ProductFamily, along with assets or any CMP data, you are trying to you’re trying to associate with the product. So when we looked at this last time, we looked at pulling products from an external system, your existing PIM or, you know, whichever system you maintain your products in the raw values, push them through the azure queues to content hub where we are hydrating the product with more information and enriching the data, you know, content which can be shown on different channels. And that’s the key to content, because you can just think of the web channel. It’s multiple channels and somehow getting it back into XP or XC different. And at least one of the channels, which is a frontend site, can show those. Now, how do we do that? So, the way we ended up doing it and we’re trying to find efficiencies in doing so is using the existing integrations content hub already has with Azure service bus message bus. Right. So, event bus, I mean so, you know, once something changes in content hub especially, we are interested in the PCM product. When it’s in the published state, we want to trigger an action and that will put a message inside of the Azure service bus, which is then picked up by your end system. In this case, it’s Sitecore commerce. And then that system will do a call back to content hub and pull the value for the product update itself. And then at some point that gets pushed onto the front-end website. So, we’ll take a look at how we did this.
Ok, so how did we handle this? So, what we did is we went ahead and defined and an action essentially it is going to trigger this action will put a message instead of the Azure service bus we provided the endpoint as well as the destination. We specified this. The creation is very similar to what you would do for the CMP integration. So, we’re relying on Azure service bus it isn’t the most reliable. I would say. I have seen some instances where the trigger happens, but the message doesn’t get pushed into the service bus. So, this we’re working on reliability. We are also working on finding a secondary method as well. So, again, you create a trigger. It’s based on modification and whenever the product status jumps to approves. So, if you know it’s approved, you go back, make some changes, come back and do approved. This trigger would trigger, thereby triggering the action, dumping a message in the service bus, which then gets picked up by commerce processes. It pulls the entity M.PCM.Product updates itself. And then the message is released from the server bus. On the left, we have a product from PCM. Again, the standard product. We have not extended it as much. The number corresponds with the product number corresponds with the product inside of commerce. It’s in the draft state. And again, we made it so that only in the approved state would it get triggered and then it’ll go into the queue. We extended the product with these two fields in the sample application and technically, once we do this update, we should see a value in there. So, I’m going to just modify this just a tad bit.
I am going to update that, hit save, submit that and then go through the whole workflow process in order to get it approved, once it's approved. I want to make sure I come back here and then I will peek for a message. Let’s see if the message already went through, which is crazy. Let’s see if we can refresh this now. And then, as you can see, we got our fields updated, it’s pretty quick. Again, we’re trying to find better ways than a service bus, maybe a queue or something of that sort, which gives us a little bit more fault tolerance. But so far, this works fine. We’ve been able to do multiple products like this based on the event as well as this, have a secondary method in order for us to be able to synchronize on a nightly basis. I hope you found this helpful.
Thanks again for joining us for this video. We produce a lot of content in the Sitecore and Content Hub space, so subscribe to our LinkedIn, Twitter, and YouTube channels to keep yourself updated. Thanks again.
If you have any questions, please get in touch with me. @akshaysura13 on Twitter or on Slack.
Akshay is a nine-time Sitecore MVP and a two-time Kontent.ai. In addition to his work as a solution architect, Akshay is also one of the founders of SUGCON North America 2015, SUGCON India 2018 & 2019, Unofficial Sitecore Training, and Sitecore Slack.
Akshay founded and continues to run the Sitecore Hackathon. As one of the founding partners of Konabos Consulting, Akshay will continue to work with clients to lead projects and mentor their existing teams.