cancel
Showing results for 
Search instead for 
Did you mean: 

Publish or undeploy promotion via a cronjob in Hybris

Former Member
0 Kudos
1,400

I would like to publish or undeploy promotions which is built on the new promotion engine (rule base) via a cronjob according to dates that determine in the backoffice as a seperate model that has promotion code, start date and end date.

I could not find the promotion api in help hybris to perform publish and undeploy operations like in the backoffice. And also I could not find related promotion services in the project.

Any help would be appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

vinay_malempati
Active Participant
0 Kudos

You can use the OOTB api,

To publish, you can use

 final RuleCompilerPublisherResult ruleCompilerPublisherResult =  ruleMaintenanceService.compileAndPublishRulesWithBlocking(promotions, moduleName,false);
 

To unpublish you can use this :

     java.util.Optional<de.hybris.platform.ruleengineservices.maintenance.RuleCompilerPublisherResult> result  = ruleMaintenanceService.undeployRules(allPromotions, moduleName);