CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
priti_mittal
Advisor
Advisor
0 Kudos
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.