Creating Action Definition

Define a rule action and implement the rule executable action.

Procedure

  1. Add the action definition:

    promotionenginetrail/resources/impex/projectdata-promotionenginetrail.impex

    $lang=en
     
    INSERT_UPDATE UserGroup;uid[unique=true];groups(uid)
    ;reviewedProductsCustomerGroup;
     
    INSERT_UPDATE RuleActionDefinitionCategory;id[unique=true];name[lang=$lang];priority
    ;customer;Customer;700
     
    INSERT_UPDATE RuleActionDefinition;id[unique=true];name[lang=$lang];priority;breadcrumb[lang=$lang];translatorId;translatorParameters;categories(id)
    ;add_customer_to_group;Add customer to group;200;Add customer to group {customer_group};ruleExecutableActionTranslator;actionId->addUserToUserGroupAction;customer
     
    INSERT_UPDATE RuleActionDefinitionParameter;definition(id)[unique=true];id[unique=true];priority;name[lang=$lang];description[lang=$lang];type;value;required[default=true]
    ;add_customer_to_group;value;100;Customer group;Customer group;ItemType(UserGroup);;
    
    INSERT_UPDATE RuleActionDefinitionRuleTypeMapping;definition(id)[unique=true];ruleType(code)[default=PromotionSourceRule][unique=true] 
    ;add_customer_to_group;

    <translatorId> refers to the bean ID of the Java class that converts definition to intermediate presentation.

    <actionId> refers to the bean ID of the Java class that executes the action.

  2. Stop the server, and then compile using ant all.
  3. Update the system using the Hybris Administration Console. Make sure to include project data of the promotionenginetrail extension or import the contents of the file directly via the impex console of the HAC. Then, verify that data entered in the impex file are successfully imported.

Next Steps

Proceed to Creating Promotion Rules and Testing the Trail topic.