Showing posts with the label Hybris groovy script cronjob

How to create a Cronjob using Groovy script in SAP Hybris

You can skip scenario and root cause section below, if you only interested in the groovy script cronjob steps Scenario When we create the ProductReference inside the Product(for stage catalog) using Impex/API. The owning product is not getting sync when we do a catalog sync. Root Cause As per wiki Modification time issues: Keep in mind that changing a part-of item does not mark its owning item modified automatically. To allow synchronization to schedule the owning item correctly you have to mark it modified manually, preferably inside the part-of item's business code. So here, we can write After Save Event or groovy script to update its owning item(Product) modification time. Now let's see, how can we handle this using groovy script in SAP Hybris. Solution To configure the groovy script as a cronjob, you have to create an instance of Script - the item type where the script content is going to store. ScriptingJob - a new ServicelayerJob item, which contains additionally the scriptUR…