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.
Before you begin
Option | Description |
---|---|
Base object definition classes | |
Base object definitions | These definitions are stored in the LOBTools/WebContent/config/commerce/marketing/restricted/customerSegment/CustomerSegmentElementObjectDefinition.def file. |
Review the MGPCONDELE table:
About this task
Procedure
- Open WebSphere 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/lzx/your_company_name/marketing/objectDefinitions/customerSegment/
- LOBTools/WebContent/config/your_company_name/marketing/objectDefinitions/customerSegment/
- Create the new file for the customer segment attribute
object definition:
Option Description OpenLaszlo class file Name the file using this syntax: attribute_nameObjectDefinition.lzx; for example, LoyaltyPointsObjectDefinition.lzx. Definition file Name the file using this syntax: attribute_nameObjectDefinition.def; for example, LoyaltyPointsObjectDefinition.def. - Define the new customer segment attribute object definition:
Option Description Create a new child object class - Define a new child object class to represent a customer segment
attribute OR list or AND list condition that:
- Extends from wcfChildObjectDefinition.
- Has a globally unique
objectType
value. - Has a
baseType
of mktCSElementAndOrListConditionObjectDefinition. - Contains one or more child object definitions that have a
baseType
of mktCSElementSimpleConditionObjectDefinition used to represent a customer segment simple condition.
Here is an example:<library> <class name = "mktLoyaltyPointsListObjectDefinition" extends = "wcfChildObjectDefinition" objectType = "LoyaltyPointsList" baseType = "mktCSElementAndOrListConditionObjectDefinition"> <wcfChildObjectDefinition objectType = "LoyaltyPointsCondition" baseType = "mktCSElementSimpleConditionObjectDefinition"> <dataset name = "template"> <conditionVariable>loyalty</conditionVariable> </dataset> <wcfPropertyDefinition propertyName = "conditionValue" required = "true" type = "integer" displayName = "Number of points"/> </wcfChildObjectDefinition> </class>
- Define another new child object class that:
- Extends from wcfChildObjectDefinition.
- Has a globally unique
objectType
value. - Is a
singleInstance
object. - Has a
templateTypeProperty
defined. - Has an
idProperty
ofelementName
. - Has a
dataset
namedtemplate
. - Has one or more child wcfObjectTemplate objects defined.
- Contains a child instance of a class that extends from mktCSElementAndOrListConditionObjectDefinition.
Here is an example:<class name = "extLoyaltyPointsObjectDefinition" extends = "wcfChildObjectDefinition" objectType = "LoyaltyPoints" singleInstance = "true" templateTypeProperty = "template" idProperty = "elementName"> <dataset name = "template"> <elementName>LoyaltyPoints</elementName> <template>ignore</template> </dataset> <mktLoyaltyPointsListObjectDefinition/> <wcfObjectTemplate templateType = "ignore" displayName = "Ignore customer loyalty points"> <dataset name = "template"/> </wcfObjectTemplate> <wcfObjectTemplate templateType = "lessThan" displayName = "Number of points is less than or equal to the following number"> <dataset name = "template"> <object objectType = "LoyaltyPointsList"> <elementName>loyalty</elementName> <conditionUsage>orListCondition</conditionUsage> <object objectType = "LoyaltyPointsCondition"> <conditionOperator><=</conditionOperator> </object> </object> </dataset> </wcfObjectTemplate> <wcfObjectTemplate templateType = "greaterThan" displayName = "Number of points is greater than or equal to the following number"> <dataset name = "template"> <object objectType = "LoyaltyPointsList"> <elementName>loyalty</elementName> <conditionUsage>orListCondition</conditionUsage> <object objectType = "LoyaltyPointsCondition"> <conditionOperator>>=</conditionOperator> </object> </object> </dataset> </wcfObjectTemplate> <wcfObjectTemplate templateType = "between" displayName = "Number of points is within the following range"> <dataset 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> </dataset> </wcfObjectTemplate> </class> </library>
Create 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 wcfChildObjectDefinition.
- Has a
baseDefinitionName
of mktCSElementAndOrListConditionObjectDefinition. - Has a globally unique
objectType
value. - Contains one or more child object definitions that have a
baseDefinitionName
of mktCSElementSimpleConditionObjectDefinition used to represent a customer segment simple condition.
Here is an example:<Definitions> <ChildObjectDefinition definitionName = "mktLoyaltyPointsListObjectDefinition" objectType = "LoyaltyPointsList" baseDefinitionName = "mktCSElementAndOrListConditionObjectDefinition"> <ChildObjectDefinition objectType = "LoyaltyPointsCondition" baseType = "mktCSElementSimpleConditionObjectDefinition"> <Xml name = "template"> <conditionVariable>loyalty</conditionVariable> </Xml> <PropertyDefinition propertyName = "conditionValue" required = "true" type = "integer" displayName = "Number of points"/> </ChildObjectDefinition> </ChildObjectDefinition> </Definitions>
- Define another new child object definition that:
- Extends from wcfChildObjectDefinition.
- 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 mktCSElementAndOrListConditionDefinition.
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 = "mktLoyaltyPointsListObjectDefinition"/> <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>
- Define a new child object class to represent a customer segment
attribute OR list or AND list condition that:
- Add a reference to the new object
definition file in the MarketingExtensionsLibrary.lzx file.
The file is stored at this path:
LOBTools/WebContent/WEB-INF/src/lzx/commerce/marketing/
The line of code that references the new object definition should look like the following example:
<include href="../../your_company_name/marketing/objectDefinitions/customerSegment/attribute_nameObjectDefinition.lzx"/>
- Register the new object with the top customer segment AND
list object definition:
Option Description Open the LOBTools/WebContent/WEB-INF/src/lzx/commerce/marketing/objectDefinitions/customerSegment/TopAndListObjectDefinition.lzx file - Add an instance of the new customer segment condition single instance
object by inserting a line similar to the following example (see the
line in bold font):
<class name="mktTopAndListObjectDefinition" extends="wcfChildObjectDefinition" objectType="TopAndList" idProperty="elementName"> <!-- ... --> <extLoyaltyPointsObjectDefinition/> <!-- ... --> </class>
- Save and close the file.
Open the LOBTools/WebContent/config/commerce/marketing/objectDefinitions/customerSegment/TopAndListObjectDefinition.def 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="mktTopAndListObjectDefinition" idProperty="elementName" objectType="TopAndList"> … <ChildObjectDefinition baseDefinitionName="mktZipCodeObjectDefinition"/> … </ChildObjectDefinition>
- Save and close the file.
- Add an instance of the new customer segment condition single instance
object by inserting a line similar to the following example (see the
line in bold font):