Promotion Engine : Publish promotion rule via impex
Objective : The objective of this article is to explain the way to publish promotions via impex . In general Hybris backoffice could be used to publish promotions . Incase there are number of promotions then manually publishing is tedious and time taking activity . To handle such scenarios promotion publishing with the help of impex script automate the process .
Details are as follows ,
Details :
Below groovy script will publish the promotion rule in “promotions-module “ module after successful import .
de.hybris.platform.core.Registry.getApplicationContext().getBean(""ruleCompilerService"").compile( de.hybris.platform.core.Registry.getApplicationContext().getBean(""modelService"").get(impex.getLastImportedItem()),""promotions-module""); de.hybris.platform.core.Registry.getApplicationContext().getBean(""platformRuleEngineService"").initializeAllRulesModules();
Example :
$defaultPromoGrp=TestPromoGrp
$defaultStatus=PUBLISHED
INSERT_UPDATE PromotionSourceRule ; code[unique=true] ; version[unique=true]; name[lang=en] ; status(code) ; priority ; maxAllowedRuns ; stackable[default=false] ; ; actions ; description[lang=en]
"#% afterEach: de.hybris.platform.core.Registry.getApplicationContext().getBean(""ruleCompilerService"").compile( de.hybris.platform.core.Registry.getApplicationContext().getBean(""modelService"").get(impex.getLastImportedItem()),""promotions-module""); de.hybris.platform.core.Registry.getApplicationContext().getBean(""platformRuleEngineService"").initializeAllRulesModules();"
#Test promotion
; test; 0; test promotion;PUBLISHED; 40; 1; true; orderPromotionRuleGroup; <replace with condition>; "[{""definitionId"":""y_trigger_message"",""parameters"":{}}]" ;; This is test promo. ; This is test promo.
Be the first to leave a comment
You must be Logged on to comment or reply to a post.