Creating the object definition for the price rule element
Create an object definition for the new condition or action to collect input from the
Management Center user interface. When business users fill in data about the new condition or action
in a price rule, the object definition persists the data in two tables: PRELEMENT and
PRELEMENTATTR.
Before you begin
About this task
<FlowElementObjectDefinition>
element. Procedure
- Open HCL Commerce Developer and switch to the Enterprise Explorer view.
-
Create a directory to store your new price rule element object definition.
You can store the file in a directory structure similar to the following example:
LOBTools\WebContent\WEB-INF\src\xml\your_company_name\price\objectDefinitions\priceRuleBuilder
-
Create a new definition file for the price rule element object definition. Name the file using
this syntax:
pricerule_element_nameFlowElementObjectDefinition.xml
; for example,RegistrationTimeConditionFlowElementObjectDefinition.xml
-
Define the element object definition.
The following XML code is a simple example of an object definition for a new condition element. The example is split into four parts, and each part is explained in a step after the table.
Object definition example 1 <Definitions> <FlowElementObjectDefinition definitionName = "prcRegistrationTimeConditionElementObject" displayName = "${prcMyPriceResources.RegistrationTimeCondition_displayName}" elemTemplateType="Condition" objectType = "RegistrationTimeCondition" flowIcon = "RegistrationTimeConditionElementIcon" headerIcon = "RegistrationTimeConditionElementHeaderIcon" paletteIcon = "RegistrationTimeConditionPaletteIcon" package="cmc/price" propertiesDefinitionName = "prcRegistrationTimeConditionElementProperties" summaryClass = "prcRegistrationTimeConditionElementSummary">
2 <CreateService baseDefinitionName = "prcFlowElementCreateService"> <ServiceParam name = "PROPERTY_registrationTime" propertyName = "registrationTime"/> <ServiceParam name = "PROPERTY_registrationTimeOperator" propertyName = "registrationTimeOperator" optional = "true"/> </CreateService> <UpdateService baseDefinitionName = "prcFlowElementUpdateService"> <ServiceParam name = "PROPERTY_registrationTime" propertyName = "registrationTime"/> <ServiceParam name = "PROPERTY_registrationTimeOperator" propertyName = "registrationTimeOperator" optional = "true"/> </UpdateService>
3 <PropertyDefinition propertyName = "registrationTime" required = "true" type = "date"/> <PropertyDefinition propertyName = "registrationTimeOperator"> <PropertyValue displayName = "${prcMyPriceResources.RegistrationTimeCondition_lessComparison}" value = "<"/> <PropertyValue displayName = "${prcMyPriceResources.RegistrationTimeCondition_greatComparison}" value = ">"/> <PropertyValue displayName = "${prcMyPriceResources.RegistrationTimeCondition_equalComparison}" value = "="/> </PropertyDefinition>
4 <Xml name = "template"> <elemTemplateName>RegistrationTimeCondition</elemTemplateName> <registrationTimeOperator><</registrationTimeOperator> </Xml> </FlowElementObjectDefinition> </Definitions>
-
Register the new object definition in its parent object definition:
- Open the file at the following
path:
LOBTools\WebContent\WEB-INF\src\xml\commerce\price\objectDefinitions\priceRuleBuilder\FlowPathElementObjectDefinition.xml
- Within this definition, add your new object definition as a child by inserting a single line
similar to the following example (see the second-last line in bold
font):
<ChildObjectDefinition definitionName="cmc/price/BaseFlowPathElementObject" displayName="Path" isBaseDefinition="true"> <Xml name="template"> <elemTemplateName>path</elemTemplateName> </Xml> <FlowElementObjectDefinition baseDefinitionName="cmc/price/PriceListElementObject" package="cmc/price"/> <FlowElementObjectDefinition baseDefinitionName="cmc/price/CalculatePriceElementObject" package="cmc/price"/> <FlowElementObjectDefinition baseDefinitionName="cmc/price/ExternalPriceRuleElementObject" package="cmc/price"/> <FlowElementObjectDefinition baseDefinitionName="cmc/price/CatalogConditionElementObject" package="cmc/price"/> <FlowElementObjectDefinition baseDefinitionName="cmc/price/SimpleBranchElementObject" package="cmc/price"/> <FlowElementObjectDefinition baseDefinitionName="cmc/price/CompareConditionElementObject" package="cmc/price"/> <FlowElementObjectDefinition baseDefinitionName="cmc/price/NestedPriceRuleElementObject" package="cmc/price"/>
<FlowElementObjectDefinition baseDefinitionName="cmc/price/MyCustomConditionElementObject" package="cmc/price"/>
</ChildObjectDefinition> - Add a dependency to the
prc
module similar to thePriceResources
dependency in the file. - Save and close the file.
- Open the file at the following
path: