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/your_company_name/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
baseDefinitionName
ofCSElementAndOrListConditionObjectDefinition
. - Has a globally unique
objectType
value. - Contains one or more child object definitions that have a
baseDefinitionName
ofCSElementSimpleConditionObjectDefinition
used to represent a customer segment simple condition.
Here is an example:<Definitions> <ChildObjectDefinition definitionName = "LoyaltyPointsListObjectDefinition" objectType = "LoyaltyPointsList" baseDefinitionName = "CSElementAndOrListConditionObjectDefinition"> <ChildObjectDefinition objectType = "LoyaltyPointsCondition" baseType = "CSElementSimpleConditionObjectDefinition"> <Xml name = "template"> <conditionVariable>loyalty</conditionVariable> </Xml> <PropertyDefinition propertyName = "conditionValue" required = "true" type = "integer" displayName = "Number of points"/> </ChildObjectDefinition> </ChildObjectDefinition> </Definitions>
- Extends from
- Define another new child object definition that:
- Extends from
ChildObjectDefinition
. - Has a globally unique
objectType
value. - Is a
singleInstance
object. - Has a
templateTypeProperty
defined. - Has an
idProperty
ofelementName
. - Has an
Xml
element namedtemplate
. - Has one or more child
ObjectTemplate
elements defined. - Contains a child definition that is based on
CSElementAndOrListConditionDefinition
.
Here is an example that adds this new child object definition as a child element of the Definitions element:<ChildObjectDefinition definitionName = "extLoyaltyPointsObjectDefinition" objectType = "LoyaltyPoints" singleInstance = "true" templateTypeProperty = "template" idProperty = "elementName"> <Xml name = "template"> <elementName>LoyaltyPoints</elementName> <template>ignore</template> </Xml> <ChildObjectDefinition baseDefinitionName = "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>
- 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 baseDefinitionName="cmc/marketing/LoyaltyPointsListObjectDefinition"/> … </ChildObjectDefinition>
- Save and close the file.