0

We are using Sitecore Commerce Connect to sync the data from Hybris to Sitecore. Currently on click of Product Sync button from the content editor ribbon, it calls a command: Sitecore.Commerce.Commands.Products.SynchronizeAllProducts, Sitecore.Commerce to sync the products.

But we wanted to schedule this Sitecore Commerce Connect product sync as a daily batch job.

Basically the default Product Sync command ( Sitecore.Commerce.Commands.Products.SynchronizeAllProducts, Sitecore.Commerce) should be invoked by a Batch job, I have followed the below steps:

  1. Created a command item and Mentioned the Type as Sitecore.Commerce.Commands.Products.SynchronizeAllProducts, Sitecore.Commerce and Method as Execute
  2. Created a schedule item and associated the above command.

But when the scheduler executes, I am getting an error:

Execute method NOT found

I have tried with StartProcess method as well. It didn't work for me. Can you please advise?

Regards, Sharath

1 Answer 1

1

It would be helpful to provide some more details on what version of Sitecore and Commerce Connect you are using.

In one of our SC8.2 projects with a Commerce Connect product synchronization we have daily scheduled synchronizations using Sitecron (https://www.akshaysura.com/tag/sitecron/).

I do recommend using Sitecore because it's far more precise then OOTB scheduling in Sitecore. With Sitecore OOTB scheduling your sync will "slide", so you can't guarantee the exact starting time.

In the SyncJob we basically setup start the sync like this:

var productListRequest = new GetExternalCommerceSystemProductListRequest
{
    Language = lang.Name
};

var productSynchronizationProvider = new ProductSynchronizationProvider();
productSynchronizationProvider.SynchronizeProducts((SynchronizationRequest)productListRequest);

In our case we are running synchronizations in 20 languages, so it's wrapped in a foreach going over all languages.

Back then this was the easiest (working) thing we could come up with. I think part (or all) of this code is based on commands you describe, which we decompiled with dotPeek.

In case you're talking Sitecore 9 and SXC9 I'm not sure, but I thougth product synchronization was not supported at all.

4
  • Thanks a ton @andredezwart , public class SyncProducts { public void start() { var productListRequest = new GetExternalCommerceSystemProductListRequest { Language = Sitecore.Context.Language.Name }; var productSynchronizationProvider = new ProductSynchronizationProvider(); productSynchronizationProvider.SynchronizeProducts((SynchronizationRequest)productListRequest); } } 1. Create a command and call start method for a command 2. Create a scheduler to call the command defined above Will this work?
    – Sharath
    Commented Feb 28, 2019 at 7:11
  • @Sharath yes, that's basically it. I can still recommend using Sitecron to schedule the task as it is far more precise then OOTB Sitecore Scheduling. This blog shows how to set it up.. Commented Feb 28, 2019 at 8:31
  • Thanks @andredezwart :-)
    – Sharath
    Commented Jun 7, 2019 at 10:35
  • No problem @Sharath. Feel free to mark the answer as accepted ;-) Commented Jun 8, 2019 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.