Creating the object definition for the customer segment attribute
Create a new object definition for the new customer segment attribute to collect input from the Management Center user interface. When business users fill in data about the new attribute in a customer segment, the object definition persists the data in the MGPCONDELE database table.
About this task
Procedure
- Open HCL Commerce Developer and switch to the Enterprise Explorer view.
-
Create a directory to store your new customer segment object definition.
Use a directory structure similar to the following example:
- LOBTools/WebContent/WEB-INF/src/xml/mycompany/marketing/objectDefinitions/customerSegment/
- Create the new file for the customer segment attribute object definition. Name the file using this syntax: attribute_nameObjectDefinition.xml; for example, LoyaltyPointsObjectDefinition.xml.
-
Define the new customer segment attribute object definition by creating a new child
object definition:
- Define a new child object definition to represent a customer segment attribute
OR list or AND list condition that:
- Extends from
ChildObjectDefinition. - Has a
baseDefinitionNameofCSElementAndOrListConditionObjectDefinition. - Has a globally unique
objectTypevalue. - Contains one or more child object definitions that have a
baseDefinitionNameofCSElementSimpleConditionObjectDefinitionused to represent a customer segment simple condition.
- Extends from
- Define another new child object definition that:
- Extends from
ChildObjectDefinition. - Has a globally unique
objectTypevalue. - Is a
singleInstanceobject. - Has a
templateTypePropertydefined. - Has an
idPropertyofelementName. - Has an
Xmlelement namedtemplate. - Has one or more child
ObjectTemplateelements defined. - Contains a child definition that is based on
CSElementAndOrListConditionDefinition.
Here is an example that adds a new child object definition as a child element of the Definitions element:<Definitions> <ChildObjectDefinition definitionName="cmc/marketing/LoyaltyPointsListObjectDefinition" objectType="LoyaltyPointsList" baseDefinition="cmc/marketing/CSElementAndOrListConditionObjectDefinition"> <ChildObjectDefinition baseDefinition="cmc/marketing/CSElementSimpleConditionObjectDefinition" objectType="LoyaltyPointsCondition"> <Xml name="template"> <conditionVariable>loyalty</conditionVariable> </Xml> <PropertyDefinition propertyName="conditionValue" required="true" type="integer" displayName="Number of points"/> </ChildObjectDefinition> </ChildObjectDefinition> <ChildObjectDefinition definitionName="cmc/marketing/LoyaltyPointsObjectDefinition" objectType="LoyaltyPoints" singleInstance="true" templateTypeProperty="template" idProperty="elementName"> <Xml name="template"> <elementName>LoyaltyPoints</elementName> <template>ignore</template> </Xml> <ChildObjectDefinition baseDefinition="cmc/marketing/LoyaltyPointsListObjectDefinition"/> <ObjectTemplate templateType="ignore" displayName="Ignore customer loyalty points"> <Xml name="template"/> </ObjectTemplate> <ObjectTemplate templateType="lessThan" displayName="Number of points is less than or equal to the following number"> <Xml name="template"> <object objectType="LoyaltyPointsList"> <elementName>loyalty</elementName> <conditionUsage>orListCondition</conditionUsage> <object objectType="LoyaltyPointsCondition"> <conditionOperator><=</conditionOperator> </object> </object> </Xml> </ObjectTemplate> <ObjectTemplate templateType="greaterThan" displayName="Number of points is greater than or equal to the following number"> <Xml name="template"> <object objectType="LoyaltyPointsList"> <elementName>loyalty</elementName> <conditionUsage>orListCondition</conditionUsage> <object objectType="LoyaltyPointsCondition"> <conditionOperator>>=</conditionOperator> </object> </object> </Xml> </ObjectTemplate> <ObjectTemplate templateType="between" displayName="Number of points is within the following range"> <Xml name="template"> <object objectType="LoyaltyPointsList"> <elementName>loyalty</elementName> <conditionUsage>andListCondition</conditionUsage> <object objectType="LoyaltyPointsCondition" name="upperBound"> <conditionOperator><=</conditionOperator> </object> <object objectType="LoyaltyPointsCondition" name="lowerBound"> <conditionOperator>>=</conditionOperator> </object> </object> </Xml> </ObjectTemplate> </ChildObjectDefinition> </Definitions> - Extends from
- Define a new child object definition to represent a customer segment attribute
OR list or AND list condition that:
- Add a reference to the new object definition file wherever it is used.
-
Register the new object with the top customer segment AND list object
definition:
- Open the LOBTools/WebContent/WEB-INF/src/xml/commerce/marketing/objectDefinitions/customerSegment/TopAndListObjectDefinition.xml file.
- Add an instance of the new customer segment condition single instance object
by inserting an element similar to the following example (see the line in bold
font):
<ChildObjectDefinition definitionName="cmc/marketing/TopAndListObjectDefinition" idProperty="elementName" objectType="TopAndList"> ... <ChildObjectDefinition baseDefinition="cmc/marketing/LoyaltyPointsObjectDefinition"/> ... </ChildObjectDefinition> - Save and close the file.