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

In the Marketing tool, each customer segment attribute must have an object definition.

Procedure

  1. Open HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. 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/
  3. Create the new file for the customer segment attribute object definition. Name the file using this syntax: attribute_nameObjectDefinition.xml; for example, LoyaltyPointsObjectDefinition.xml.
  4. Define the new customer segment attribute object definition by creating a new child object definition:
    1. 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 of CSElementAndOrListConditionObjectDefinition.
      • Has a globally unique objectType value.
      • Contains one or more child object definitions that have a baseDefinitionName of CSElementSimpleConditionObjectDefinition 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>
    2. 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 of elementName.
      • Has an Xml element named template.
      • 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>&gt;=</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>&gt;=</conditionOperator>
                  </object>
               </object>
            </Xml>
          </ObjectTemplate>
      <ChildObjectDefinition>
  5. Add a reference to the new object definition file wherever it is used.
  6. Register the new object with the top customer segment AND list object definition:
    1. Open the LOBTools/WebContent/WEB-INF/src/xml/commerce/marketing/objectDefinitions/customerSegment/TopAndListObjectDefinition.xml file.
    2. 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>
    3. Save and close the file.