Creating the object definition for the campaign element

Create an object definition for the new campaign element to collect input from the Management Center user interface. When business users enters data about the new campaign element in a marketing activity, the object definition persists the data in two tables: DMELEMENT and DMELEMENTNVP.

Before you begin

Review the following topics to ensure that you understand object definitions in Management Center and the mktFlowElementObjectDefinition class that you must extend:

For information about creating resource bundles for text strings, see Defining user interface text in Management Center.

About this task

In the Marketing tool, each campaign element must have an object definition. Each object definition extends the mktFlowElementObjectDefinition class.

Procedure

  1. Open HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. Create a directory to store your new campaign element object definition.
    You can store the file in a directory structure similar to the following example: LOBTools/WebContent/config/your_company_name/marketing/objectDefinitions/activityBuilder/
  3. Create a file for the campaign element object definition:
    Name the file using this syntax: campaign_element_nameFlowElementObjectDefinition.def; for example, CustomLevelOfSupportTargetFlowElementObjectDefinition.def.
  4. Define the promotion element object definition.

    The following XML code is a simple example of an object definition for a new target. The example is split into four parts, and each part is explained in a step after the table. Your object definition might require more attributes and child definitions. For a complete explanation of this class or definition and its capabilities, see the documentation for the FlowElementObjectDefinition class.

    Object definition example for a target
    1
    <FlowElementObjectDefinition package="mkt"
            definitionName="extCustomLevelOfSupportElementObject"
            objectType="customLevelOfSupportTarget"
            displayName="${extMarketingResources.customLevelOfSupportName}"
            headerIcon="customLevelOfSupportHeaderIcon"
            flowIcon="customLevelOfSupportIcon"
            paletteIcon="customLevelOfSupportPaletteIcon"
            propertiesDefinitionName="extCustomLevelOfSupportProperties"
            summaryClass="extCustomLevelOfSupportSummary"
            elemTemplateType="Target">
    2
    <FlowElementCreateService package="mkt"/>
          <FlowElementUpdateService package="mkt"/>
    3
        <Xml name="template">
            <elemTemplateName>customLevelOfSupportTarget</elemTemplateName>
            <supportLevel>gold</supportLevel>
          </Xml>
    4
    <PropertyDefinition propertyName="supportLevel" displayName="Support Level">
             <PropertyValue displayName="Gold" value="gold"/>
             <PropertyValue displayName="Silver" value="silver"/>
             <PropertyValue displayName="Bronze" value="bronze"/>
          </PropertyDefinition>
      </FlowElementObjectDefinition>
    1. As per example section 1, specify the following attributes for the object definition:
      objectType
      A unique name for this campaign element object. By convention, this is typically the same name that you used for the associated campaign element template definition, which is stored as the NAME value in the DMELETEMPLATE table. However, if this campaign element object maps to multiple campaign element definitions, choose a descriptive value for this attribute.
      displayName
      The display text for the campaign element. You can either provide a static string, or provide a reference to a resource in your custom resource bundle, as shown in the example code. The format for this reference is:

      ${extcustom_resource_bundle_id.name_of_resource_bundle_key.string}

      headerIcon
      The image resource for the campaign element that is displayed in the top-left corner of the properties view for the campaign element. To use the generic header icon supplied with Management Center, specify one of the following image names:
      • genericTriggerHeaderIcon
      • genericTargetHeaderIcon
      • genericActionHeaderIcon
      flowIcon
      The image resource for the campaign element that is displayed in the Activity Builder work area. To use the generic flow icon supplied with Management Center, specify one of the following image names:
      • genericTriggerIcon
      • genericTargetIcon
      • genericActionIcon
      paletteIcon
      The image resource for the campaign element that is displayed in the Activity Builder palette. To use the generic palette icon supplied with Management Center, specify one of the following image names:
      • genericTriggerPaletteIcon
      • genericTargetPaletteIcon
      • genericActionPaletteIcon
      propertiesDefinitionName
      Optional: The name of the definition to use for displaying the properties view of this campaign element object. If your campaign element requires input from a business user, you must create a custom properties view definition for the user interface, which is covered in the procedure Creating the properties view for the campaign element. You can either give your custom properties view definition a name now, or update this attribute later, after you have created the custom properties view definition.
      summaryClass
      Optional: The name of the class to use for displaying the summary of this campaign element object. The summary text is displayed in the Activity Builder work area below the campaign element icon. If your campaign element requires this summary text, you must create a custom summary class, which is covered in the procedure Creating the summary for the campaign element. You can either give your custom summary class a name now, or update this attribute later, after you have created the custom summary class.
      elemTemplateType
      The type of campaign element; the value can be Target, or Action, or Trigger.
    2. As per example section 2, add the following child service definitions:
      • FlowElementCreateService
      • FlowElementUpdateService

      These services are used when business users create and update campaign elements using the Activity Builder, and might require additional attributes and child wcfServiceParam definitions, depending on the requirements of your campaign element.

      If your parameters refer to other service parameters, such as a category, then you require service parameter definitions like the following examples:

      <CreateService baseDefinitionName="mktFlowElementCreateService">
          <ServiceParam
              name = "PROPERTY_categoryIdList"
              objectPath = "ChildCatalogGroup/CatalogGroupAlias"
              propertyName = "catgroupId"
              optional = "false"/>
      </CreateService>
      <UpdateService baseDefinitionName="mktFlowElementUpdateService">
          <ServiceParam
              name = "PROPERTY_categoryIdList"
              objectPath = "ChildCatalogGroup/CatalogGroupAlias"
              propertyName = "catgroupId"
              optional = "false"/>
      </UpdateService>
    3. As per example section 3, if required add an XML element with the name attribute set to template. You can use the template to declare default values for the campaign element properties. The <Xml> element must have an <elemTemplateName> child element. The value of the <elemTemplateName> must match the value in the NAME column of the DMELETEMPLATE table for this campaign element. In the example code, the template declares a default value of gold for the supportLevel property. You can also use the template to declare child objects that will be instantiated within the new campaign element object.
    4. As per example section 4, if required, define the properties of the campaign element.
      In the example code, the campaign element object has only one property, supportLevel. More complex campaign elements can have multiple properties and child objects. At a minimum, declare property definitions for any variables the business user needs to provide that are defined in the campaign element template definition, that is, within the implementation definition and behavior rule definition in the template. Your campaign element might also require instances of:
      • ReferenceObjectDefinition
      • ChildObjectDefinition
      • nameValidator (see the subclasses of Validator for the foundation component

      Consider using the object definition of an existing, similar campaign element as a reference for your new campaign element. The existing object definition files are stored here:

      LOBTools/WebContent/config/commerce/marketing/objectDefinitions/activityBuilder/

  5. Register the new object definition in its parent object definition. Open the LOBTools/WebContent/config/commerce/marketing/objectDefinitions/activityBuilder/FlowPathElementObjectDefinition.def file:
    1. Locate the mktBaseFlowPathElementObject definition.
    2. Within this definition, add your new object definition as a child by inserting a line similar to the following example (see the line in bold font):
    3. <ChildObjectDefinition definitionName="mktBaseFlowPathElementObject"
      	displayName="${mktMarketingResources.path}"
      	isBaseDefinition="true">
      
      	<!-- ... -->
      	<FlowElementObjectDefinition package="mkt"
      		baseDefinitionName="extCustomLevelOfSupportElementObject"/>
      	<!-- ... -->
      </ChildObjectDefinition>
    4. Save and close the file.