Creating the object definition for the campaign element
Create a new object definition for the new campaign element to collect input from the Management Center user interface. When business users fill in 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
For information about creating resource bundles for text strings, see Defining properties files and bundle keys for user interface text.
About this task
- is an extension class of the mktFlowElementObjectDefinition class
- extends the mktFlowElementObjectDefinition class
Procedure
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- 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/WEB-INF/src/lzx/your_company_name/marketing/objectDefinitions/activityBuilder/
- LOBTools/WebContent/config/your_company_name/marketing/objectDefinitions/activityBuilder/
- Create a new file for the campaign element object definition:
Option Description OpenLaszlo class file Name the file using this syntax: campaign_element_nameFlowElementObjectDefinition.lzx; for example, CustomLevelOfSupportTargetFlowElementObjectDefinition.lzx. Definition file Name the file using this syntax: campaign_element_nameFlowElementObjectDefinition.def; for example, CustomLevelOfSupportTargetFlowElementObjectDefinition.def. - 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 substep 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 mktFlowElementObjectDefinition topic.
Object definition example for a target 1 <class name="extCustomLevelOfSupportElementObject" extends="mktFlowElementObjectDefinition" objectType="customLevelOfSupportTarget" displayName="${extMarketingResources.customLevelOfSupportName.string}" headerIcon="customLevelOfSupportHeaderIcon" flowIcon="customLevelOfSupportIcon" paletteIcon="customLevelOfSupportPaletteIcon" propertiesClass="extCustomLevelOfSupportProperties" summaryClass="extCustomLevelOfSupportSummary" elemTemplateType="Target">
2 <mktFlowElementCreateService/> <mktFlowElementUpdateService/>
3 <dataset name="template"> <elemTemplateName>customLevelOfSupportTarget</elemTemplateName> <supportLevel>gold</supportLevel> </dataset>
4 <wcfPropertyDefinition propertyName="supportLevel" displayName="Support Level"> <wcfPropertyValue displayName="Gold" value="gold"/> <wcfPropertyValue displayName="Silver" value="silver"/> <wcfPropertyValue displayName="Bronze" value="bronze"/> </wcfPropertyDefinition> </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>
- 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_class_id.name_of_resource_bundle_key.string}
${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
- propertiesClass
- (Optional) The name of the class 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 class 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 class a name now, or update this attribute later, after you have created the custom properties view class.
- 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.
- As per example section 2,
add the following child service definitions:
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:
<mktFlowElementCreateService> <wcfServiceParam name = "PROPERTY_categoryIdList" objectPath = "ChildCatalogGroup/CatalogGroupAlias" propertyName = "catgroupId" optional = "false"/> </mktFlowElementCreateService>
<CreateService baseDefinitionName="mktFlowElementCreateService"> <ServiceParam name = "PROPERTY_categoryIdList" objectPath = "ChildCatalogGroup/CatalogGroupAlias" propertyName = "catgroupId" optional = "false"/> </CreateService>
<mktFlowElementUpdateService> <wcfServiceParam name = "PROPERTY_categoryIdList" objectPath = "ChildCatalogGroup/CatalogGroupAlias" propertyName = "catgroupId" optional = "false"/> </mktFlowElementUpdateService>
<UpdateService baseDefinitionName="mktFlowElementUpdateService"> <ServiceParam name = "PROPERTY_categoryIdList" objectPath = "ChildCatalogGroup/CatalogGroupAlias" propertyName = "catgroupId" optional = "false"/> </UpdateService>
- As per example section 3,
if required:
- Declare a single instance of a dataset
with the name
template
. You can use the template dataset to declare default values for the campaign element properties. The<dataset>
element must have an<elemTemplateName>
child element. The value of<elemTemplateName>
must match a value in the NAME column of the DMELETEMPLATE table for this campaign element. In the example code, the dataset declares a default value ofgold
for thesupportLevel
property. You can also use the template dataset to declare child objects that can be instantiated within the new campaign element object. For more details on using a template dataset, see wcfObjectDefinition. - 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 ofgold
for thesupportLevel
property. You can also use the template to declare child objects that will be instantiated within the new campaign element object. For more details on using a template, see wcfObjectDefinition.
- Declare a single instance of a dataset
with the name
- As per example section 4,
if required, define the properties of the campaign element.See lzx/commerce/foundation/restricted/PropertyDefinition.lzx/wcfPropertyDefinition. 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 wcfPropertyDefinition instances or 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:- wcfReferenceObjectDefinition
- wcfChildObjectDefinition
- wcfnameValidator (see the subclasses of wcfValidator that start with
wcf
)
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/WEB-INF/src/lzx/commerce/marketing/objectDefinitions/activityBuilder/
LOBTools/WebContent/config/commerce/marketing/objectDefinitions/activityBuilder/
- As per example section 1,
specify the following attributes for the object definition:
- 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/activityBuilder/campaign_element_nameFlowElementObjectDefinition.lzx"/>
- Register the new object definition in its parent object
definition:
Option Description Open the LOBTools/WebContent/WEB-INF/src/lzx/commerce/marketing/objectDefinitions/activityBuilder/FlowPathElementObjectDefinition.lzx file - Locate the
mktBaseFlowPathElementObject
class. - Within this class, create an instance of your new object definition as a child by inserting a line similar to the following example (see the line in bold font):
<class name="mktBaseFlowPathElementObject" extends="wcfChildObjectDefinition" displayName="${mktMarketingResources.path.string}" isBaseDefinition="true"> <!-- ... --> <extCustomLevelOfSupportElementObject/> <!-- ... --> </class>
- Save and close the file.
Open the LOBTools/WebContent/config/commerce/marketing/objectDefinitions/activityBuilder/FlowPathElementObjectDefinition.def file - Locate the
mktBaseFlowPathElementObject
definition. - 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):
<ChildObjectDefinition definitionName="mktBaseFlowPathElementObject" displayName="${mktMarketingResources.path}" isBaseDefinition="true"> <!-- ... --> <FlowElementObjectDefinition package="mkt" baseDefinitionName="extCustomLevelOfSupportElementObject"/> <!-- ... --> </ChildObjectDefinition>
- Save and close the file.
- Locate the