Using Extensions

This chapter provides an overview of the process of creating Extensions. It contains the following sections:

Click to jump to parent topicUnderstanding Extensions

This chapter assumes that you are familiar with the software development process and the creation of Java servlets and PeopleCode functions. It further assumes familiarity with the Online Marketing system and its architecture and database structure.

PeopleSoft recommends that you use the expertise of PeopleSoft’s technical consultants for the development of any Extensions you need, as they have expertise in writing Java servlets and PeopleCode functions along with a thorough knowledge of PeopleSoft Online Marketing and its database structure. If you are a licensed customer you can also use this documentation to develop extensions using your own software developers.

Note. Support of any custom-written Extension (defined as any extension that does not ship with the Online Marketing product) is not offered through PeopleSoft’s Customer Connection organization. Therefore, if you choose to develop Extensions in-house and need assistance (such as troubleshooting or testing assistance) beyond what this documentation provides, contact your PeopleSoft account manager who can help you decide which consulting services are appropriate.

There are two kinds of Extensions:

Click to jump to parent topicOverview of Benefits and Usage

Online Marketing provides the ability to merge data dynamically into documents using the Merge capability. The custom content extension extends this capability by allowing you to merge in external, customized content dynamically based on the profile interests of each recipient and your marketing strategy.

The custom action extension enables you to extend actions in the dialog process. Custom actions are custom Java Servlets or People Code Application classes that can execute business logic, update or retrieve profile information, and even retrieve or post information to external systems. You can insert custom actions as subtasks in both the Reach and Response actions of the Online Marketing dialog process.

Click to jump to parent topicCommon Usage Scenarios

The following scenarios show examples of how Extensions can be used.

Click to jump to top of pageClick to jump to parent topicCustom Content Scenarios

The following scenarios illustrate some uses for custom content.

Click to jump to top of pageClick to jump to parent topicCustom Action Scenarios

The following scenarios illustrate some uses for custom actions.

Click to jump to parent topicCreating and Using Extensions

Creating and using an Extension consists of the following steps. Each step will be described in greater detail in this section.

  1. Define your extension requirements

  2. Write the extension (a Java servlet compiled into class files or a PeopleCode Application class). If your extension is developed in People Code, you can skip step 3.

  3. Package your extension java class file in a jar file and supply the name of the jar file directory in the extensionsDir parameter (set on the Online Marketing Settings page).

  4. Register the extension using Online Marketing.

  5. For custom content extensions, insert the Online Marketing formatted syntax using the Merge Content page to choose an extension, then specifying any needed parameters and their values in the desired email or web document. For custom action extensions, insert the custom action in the dialog process, specifying any needed parameters and their values.

  6. Test the extension in a development environment.

  7. Test the extension on your Online Marketing production system, testing the dialog that uses the extension.

  8. After the dialog is successfully tested, go live with the test dialog to a test audience.

  9. Go live with the extension in a production dialog to the desired audience.

See Also

Designing the Flow for an Online Dialog

Designing Web Documents

Designing Email Documents

Click to jump to top of pageClick to jump to parent topicDefining Extension Requirements

Every Extension is different, determined by the business needs of the person who will be using it. Before you begin work on an extension, ascertain your business needs. Determine what you want the extension to do, any particular needs or wishes you have, and what your expectations are (including expectations for error handling). Try to get as much specific detail as you can—the more you understand your needs, the more effectively you can meet them.

After you have determined your needs, create a detailed statement of work describing the extension, what it will do, the parameters it needs, and how you will implement it. Create a design for the extension before you begin writing it.

Click to jump to top of pageClick to jump to parent topicWrite the Java Servlet

It is beyond the scope of this chapter to describe the general process for creating a Java servlet. However, there are some aspects of servlet creation specific to an Online Marketing Extension servlet. These are discussed in this section. Also, Online Marketing ships with three sample servlets named HelloWorld, SampleLiveExtension, and EXStockQuotes, which you can find in com.peoplesoft.crm.omk.examples.jar. You can use these servlets for custom content extension testing purposes and as a guide for creating your own servlets.

Servlet Imports

The servlet should include the following import statement to access the Extension framework:

import com.peoplesoft.crm.omk.external.GenericAnnuncioServlet

Note. The class of com.peoplesoft.crm.omk.external.GenericAnnuncioServlet is included in the jar file com.peoplesoft.crm.omk.jar, so you can use it to compile your extensions. This jar file can be found in the PeopleSoft Application Server install root/class directory.

Servlet Class Inheritance

The servlet class should be declared to extend the GenericAnnuncioServlet class. For example:

Public class myDemoServlet extends GenericAnnuncioServlet

This extension provides access to logging and tracing.

Note. Because the GenericAnnuncioServlet class is extended from Java servlets (not from HTTP servlets), the Extensions framework does not fully support HTTP protocol (such as HTTP sessions).

Output

Extension output for merge purposes can use the standard servlet ServletOutputStream provided with the servlet class via its response mechanism.

Note. Output is applicable only to custom content extensions; it will be ignored by custom action extensions.

Extension Framework Error Handling

The Extension framework handles errors for custom content extensions in the following ways, depending on the type of document:

Document Type

Error Handling Method

Web documents and single emails

Communication is assumed to be synchronous. If asynchronous communication is used, no default values will be rendered.

A configurable timeout period, global for all dialogs, ensures that if content is not returned in a specified period of time, a default is inserted in place of the content. (It is possible to insert one or more blank lines as a default.) The Online Marketing log files provide information to help diagnose why the original content was not returned.

The timeout period can also be set for a specific function call.

Broadcast email jobs

A predefined timeout period ensures that if email content is not returned after this period, the entire remaining broadcast email job aborts. In the case of errors that prevent content from being properly inserted into the emails, the emails are not sent. A thrown VCSingleContactException will also result in an individual email not being sent. The Online Marketing log files provide information to help diagnose why the content could not be accessed.

Whether because of timeout or other error, if any emails that are part of a broadcast email job are not sent, you can use the Online Marketing Control Center to identify which emails were not sent and then resend them. This does not happen automatically, as it might be necessary to investigate the problem before resending the emails.

Note that timeouts and errors that occur when processing asynchronous extensions do not prevent email from being sent. This is in contrast to synchronous behavior.

Extensions That Call Classes in External jar Files

If the custom extension needs to call classes in external jar files (such as CI methods or third-party methods), then these jar files must be added to the webserver's system classpath to be available to the extensions. The procedures for doing so are as follows:

WebLogic:

  1. Put the jar files in a known location (for example, C:\Jars\myci.jar).

  2. Go to <PS_HOME>/webserv/omk.

  3. Open the setenv.cmd file.

  4. Scroll to near the end, where you will see a line setting the CLASSPATH variable. For example:

    SET CLASSPATH=%PSCLASSPATH%;%PLATFORM_PATCH%;%JAVA_HOME%\lib\tools.jar;%WL_HOME%\ server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar

  5. Add your jar file location to the end of the CLASSPATH setting. For example:

    SET CLASSPATH=%PSCLASSPATH%;%PLATFORM_PATCH%;%JAVA_HOME%\lib\tools.jar;%WL_HOME%\ server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;c:\Jars\myci.jar

  6. Restart the DES server.

WebSphere:

  1. Go to the lib directory of the WebSphere installation.

  2. Put the external jar file in this directory.

  3. Restart the DES server.

Click to jump to top of pageClick to jump to parent topicWrite the PeopleCode Function

It is beyond the scope of this chapter to describe the general process for creating a PeopleCode function. Refer to your PeopleCode documentation for more information.

Note. PeopleCode extensions can only be used as Custom Actions in the Online Marketing dialog flow.

Example PeopleCode Function

The following is an example extension, written in a PeopleCode extension class, that uses MessageBox to write its parameter names and values to the Application Server log:

import RY_DATAOBJS:*; class CustomAction; method CustomAction(); method actionMethod(&params As MapObj); end-class; method CustomAction end-method; method actionMethod /+ &params as RY_DATAOBJS:MapObj +/ Local string &msg; Local array of string &keys; Local integer &i; &msg = "actionMethod("; &keys = &params.keys(); For &i = 1 To &keys.Len If &i > 1 Then &msg = &msg | ","; End-If; &msg = &msg | &keys [&i] | "=" | &params.get(&keys [&i]).value; End-For; &msg = &msg | ");"; MessageBox(0, "", 0, 0, &msg); end-method;

The custom action receives a single parameter of type RY_DATAOBJS:MapObj. This is a name/value map which maps parameter names to parameter values. All names are strings; all values are of type RY_DATAOBJS.StringObj.

To get a PeopleCode string from StringObj, use its value property. The contents of the map will consist of all parameters defined when the action was registered, any additional parameters added when the action was included in a dialog, plus any document/profile fields on the page that was submitted to cause the action to be invoked.

PeopleCode actions are invoked asynchronously, and need not return a value.

See Also

Enterprise PeopleTools 8.48 PeopleBook: PeopleCode Language Reference

Enterprise PeopleTools 8.48 PeopleBook: PeopleCode Developer's Guide

Click to jump to top of pageClick to jump to parent topicInstall the Extension Class Files on DES and Mailcaster Machines

If you have written a Java servlet for your Extension and compiled it as class files, perform the following installation steps:

  1. Add the class file in a jar file with the full package path.

  2. Set the jar file name on the Extension Registration page.

  3. Put the jar file in a directory that includes other Extension jar files for Online Marketing. The directory name must be set to the value of the parameter extensionsDir on the Setting page.

If the DES and Mailcaster are installed on different machines, and the location of the extension jar file is not accessible from one of the machines, the extensionsDir value for individual service can be overwritten in the service's configuration file. For example, if the Extension jar can be accessed from DES, but not from all the Online Marketing other services (Mail service, WatchDog, and Email Response Processor), you should do the following:

  1. Install the Extension jar file in a location accessible to DES. Set the jar location to extensionsDir in the DES Settings page.

  2. Install the Extension jar file in a location where it is accessible to other Online Marketing services (such as Mailcaster).

  3. For each services instance, add extensionsDir="extension jar dir" (see step 2 above) in the relevant configuration file (for example, MCR.config for Mailcaster).

In this case, DES will load the Extension jar file by using the value of extensionsDir from settings, and the Mailcaster will load the Extension jar by using the value of extensionsDir from the MCR.config file.

Click to jump to top of pageClick to jump to parent topicCreate the Online Marketing Formatted Syntax

For custom content extensions (used in web and email documents), merge content is used to specify an extension to be executed. The merge content format is similar to the Online Marketing merge content format. It is not necessary to create this Online Marketing formatted syntax for custom action extensions.

The basic format for custom content extensions is:

<pstag:extension name="<name>" default="<details of function>" id="<VC Reference ID>"/>

The merge content identifier that identifies the extension to execute is pstag: extension name=”<name>”, where

pstag

is the Online Marketing VC Tag identifier.

name=”<name>”

The name of the extension.

default value

If the extension has no result, specify a default value to be used in the document.

id

The merge content reference identifier.

This tag must appear first in the merge content syntax. For example:

<pstag:extension name="Hello" default="<details of function>" id="1234" />

Global Extension Parameters

The following parameters can also be used in Extensions, and can appear in any order. These parameters apply to both custom content and custom action extensions. They are set in the Settings feature.

Parameter

Allowable Values

timeout

0

Indicates that the request is not subject to timeout management.

1..n

Any valid integer greater than zero (0) indicates the number of seconds before timeout occurs.

All other values including value parsing errors result in the system default timeout being used. The default value is 45.

async

true

Indicates that this is an asynchronous request. The default value is false for custom content extensions (extensions inserted into documents) and custom action extensions (extensions inserted into the dialog process). The return value from an asynchronous extension is ignored.

All other values including value parsing errors result in a synchronous request.

Warning! PeopleSoft strongly recommends against using asynchronous communication for custom content extensions in broadcast emails, as the rendering of the extension might not keep pace with the speed of the Mailcaster. Synchronous communication can provide a “throttling” mechanism that prevents the extensions from using up all system resources.

default

any character string

Indicates that the specified character string will be merged exactly as typed into the merge content. This is the default value.

Notes on Designing Extensions

The following usage notes describe things you should be aware of when creating and using Extensions.

Click to jump to top of pageClick to jump to parent topicRegister the Extension in Online Marketing

To register and configure the Extension, you must have Dialog Administrator permission or permission to change settings.

Follow these steps to register and configure extensions:

  1. Navigate to Set Up CRM, Product Related, Online Marketing, Extension Summary.

    The Extension page displays a list of current extensions.

  2. In the Implement Type list, specify if the extension you want to register is a Java servlet or a PeopleCode application class.

  3. Click the Add Extension button.

Registering a Java Extension

Access the Extension Registration page.

Name

Specify a name for the extension. Spaces are allowed.

Description

Enter a brief description of the extension's function.

Status

Indicates whether the extension is ready for use by the system. An extension starts in the In Design status. You can change it to Active when it is ready to be used. Once an extension is Active, you can change it to Archived to prevent new references or usage in a document or flow. (Existing references will still continue to work.)

Type

Indicates whether the extension is written in Java or PeopleCode.

Usage

Select In Document if the extension is to be used to retrieve content for display in a document, or Process if the extension will perform a function as part of the dialog process.

Servlet Class Name

Specify a class name for the Java servlet, using the fully qualified name of the servlet (for example, com.peoplesoft.crm.omk.external.HelloWorld).

Servlet Jar File Name

Specify the name of the servlet's jar file.

Wait Return Before Process

Select this check box if the extension is to be processed synchronously, or leave it cleared if the extension is to be processed asynchronously.

Timeout

If specified, this value will override the global default specified in the extensionTimeout parameter set in the Settings component.

Custom Action Icon

When you select In Process as the Usage, you can upload a custom icon that will appear in the dialog flow when the custom action is selected. Click Upload Image to specify an image, or Delete Image to remove a previously specified image. If you do not supply a custom icon, the default custom action icon is used.

Parameters

You can define a default list of parameters for the extension during registration. These values can be overwritten by individual references to the extension in the Custom Action or Custom Content objects. All the parameters and values from the registration page, along with the overwritten or additional parameters from the specific references are passed to the system for processing.

You cannot use merge content syntax in the parameter or value fields on the registration page.

Add Parameter

Click this button to add a new parameter to the list.

Note. If your extension requires third-party classes that came in a separate jar file from the extension jar file, you must package the third-party classes in the extension jar or else ensure that the third-party jar is available in the web container's class path.

Registering a PeopleCode Extension

Registering a PeopleCode extension is similar to registering a Java extension, except that a PeopleCode extension cannot be used in the Dialog Process tree. Because of this, the Usage check box is selected and disabled.

Application Class Path

Enter the application package and class name for the PeopleCode function.

Class Method

Enter the method of the application class.

See Register the Extension in Online Marketing.

Managing Extensions

Only users with the role of Dialog Administrator can register extensions or change global settings. Once an extension is registered and its status set to Active, it cannot be deleted from system. However, the following modifications can be made, depending on the extension's status:

Extension Status

Modifications

In Design

  • Delete an extension on the Extension Summary page.

  • Delete an extension parameter on the Extension Registration page.

Active

  • Change a parameter's value (but not delete it).

  • Add a new parameter.

  • Change the status to Archived (but not back to In Design).

Note. You cannot change the extension's Name or Usage in this state. Also, when you make changes to an extension in Active state, you must restart the Dialog Execution Server for the changes to take effect.

Archived

This status is similar to Active, except that you cannot change the extension's Status. New references or usages are not allowed in either the Custom Content or Custom Action objects.

Click to jump to top of pageClick to jump to parent topicSystem Delivered Extension

One system extension, Update Case Score, is delivered in this release. It is used by Case Integration to update survey scores to Support and HelpDesk. You cannot modify the Update Case Score extension using the Extension Registration page, which is disabled for this extension.

See Understanding Surveys.

See Sending Case Surveys.

Click to jump to top of pageClick to jump to parent topicCustom Action Runtime Behavior

If you will be using custom actions to update profiles (for example, updating a profile value to a document field value or a fixed value), it is important to understand custom action runtime behavior.

The Update Profile custom action updates the profile data to the cache first. It saves the information to the database with other profile updates after all the actions are completed and before it displays the next page to the user.

Click to jump to top of pageClick to jump to parent topicCustom Action Runtime Behavior: Extension Management

If Custom Actions are used in updating user profiles (such as updating a user profile using values from document fields or fixed values), the Update Profile Custom Action updates the profile data in the cache first. The Custom Action saves to the database with all other profile updates after all of the actions are completed, and before returning the next page in the dialog flow.

Note that in the case where a Custom Action must read data from Custom Profiles (User Defined Profiles), or other Customer Data Model (CDM) profile data from database, a Page Submit action is required in order for the data to be saved to the database so that a Custom Action can read that data. To accomplish this, use an Intermediate Page Action to ensure that data is submitted to the database before the Custom Action occurs in your Dialog Flow. Custom Actions that occur before a Final Page action do not meet this requirement as the Final Page action has no Submit action.

Since profile data from Online Marketing web pages and Update Profile actions are saved to the database at the end of action execution, data from a Custom Action is saved only after it is executed. Therefore, it is recommended that in order for a Custom Action to access current profile data, it should make use of the Profile based Variable Contents in the Custom Action parameter.

Click to jump to top of pageClick to jump to parent topicTest in a Development Environment

Before attempting to deploy the Extension in a production environment, test it thoroughly in a development environment.

Click to jump to top of pageClick to jump to parent topicTest in a Staging Environment

After you have configured the Extension, test it in a staging environment, within a test dialog, to a test audience. If possible, test in an independent development system that “mirrors” the production system because the impact to the system and the DES is unknown until the Extension has been tested.

Click to jump to top of pageClick to jump to parent topicGo Live!

First, you should go live with the Extension on your production system, using a test dialog and a test audience.

After completing testing of the extension, you are now ready to deploy it in a production dialog to your desired audience.

Click to jump to parent topicExtension Programming References

This section provides reference information useful when writing your own Extensions. The following topics are covered:

Click to jump to top of pageClick to jump to parent topicReserved Words

The following reserved words should not be used in your extensions except when using them in their explicit Online Marketing-specific sense.

See Create the Online Marketing Formatted Syntax.

Click to jump to top of pageClick to jump to parent topicMerge Content Syntax

Merge content can be used when calling the extension in parameters or within the actual servlet code.

The following is the basic syntax for merge content:

{pstag:vctype [value="value"] [ default="defaultValue"]}

where

pstag

is the Online Marketing VC Tag identifier.

vctype

The merge content type (such as profile, document, and so on).

default

The keyword used to identify the default value for the merge content.

defaultValue

The value used as the default for any merge content that does not have a value. If there are spaces in the default, the value will appear within double quotes (“defaultValue”).

See Merge Content Specification.

Extension Merge Content—Company

The merge content syntax for companies in the profile database is:

<pstag:profile value="Organizations.profileName.fieldName" />

where

Organizations

indicates that the merge content data is a person or company in your profile database.

profileName

is the name of the profile.

fieldName

is the name of the profile element.

Note. Field names use the plain-text Element Name rather than the Element Permanent Name.

The following examples show Extension parameter merge content where a parameter value is set to be the value of Company merge content:

<pstag:profile value="Organizations.Companies.Organization Name" /> <pstag:profile value="Organizations.Companies.ZIP Code" /> <pstag:profile value="Organizations.Companies.Web Site Address" /> <pstag:profile value="Organizations.Companies.Organization Phone" />

Extension Merge Content—contact

The merge content syntax for people in your profile database is:

<pstag:profile value="Individuals.profileName.fieldName" />

where

Individuals

indicates that the merge content data is an individual or organization in your profile database.

profileName

is the name of the profile.

fieldName

is the name of the profile element.

Note. Field names use the plain-text Element Name rather than the Element Permanent Name.

The following examples show Extension merge content where a parameter value is set to be the value of Individuals merge content:

<pstag:profile value="Individuals.People.Source ID" /> <pstag:profile value="Individuals.People.Email" /> <pstag:profile value="Individuals.People.ZIP Code" /> <pstag:profile value="Individuals.People.Last Name" />

Extension Merge Content—document

The merge content syntax for documents is:

<pstag:document value="documentName.fieldName" id="VC Reference ID"/>

where

document

indicates that the merge content data is a field from a document.

documentName

indicates the name of the Online Marketing web or email document

fieldName

is the name of the field from the document.

id

The merge content Reference identifier.

The following example shows an Extension merge content where a document is used in merge content:

<pstag:document value="doc_enter.ticker: id="123" />

Extension Merge Content—Constants

Constants can be passed as parameters to extensions or called from within the extension. The merge content syntax for constants is:

<pstag:constantName/>

where

constantName

is the name of the constant to be used in the merge content.

The following examples show Extension merge content where a constant is used in merge content:

<pstag:currentTime format="HH:MM" /> <pstag:recipientID/> <pstag:dialogID/>

The following constants can be called in Extension constant merge content.

Click to jump to top of pageClick to jump to parent topicAvailable CGI Environment Values

The following CGI environment values are available for inclusion in Extensions. These values are typically passed from the web server.

Click to jump to top of pageClick to jump to parent topicRFC 2616 Request Headers

The following RFC 2616 request headers are available for inclusion in Extensions.

Click to jump to top of pageClick to jump to parent topicNetscape Enterprise Server-Specific Request Headers

The following Netscape Enterprise Server-Specific request headers are available for inclusion in Extensions.

Click to jump to parent topicSample Servlets

This section provides information about the sample servlets shipped with Online Marketing Extensions:

The HelloWorld servlet is a small extension you can use to test custom content extensions. The SampleLiveExtension servlet is designed to show some possibilities of the Online Marketing Extension architecture. Both are described in detail in this section.

The EXStockQuotes servlet, also included, is described briefly on page 94.

Click to jump to top of pageClick to jump to parent topicLocation of Sample Servlets

For all of the sample servlets, the class files are provided and are packaged in the jar file com.peoplesoft.crm.omk.examples.jar.

where selected_path is the pathname where you chose to install the files.

Note. The files exist on machines where Online Marketing Dialog Server or Mailcaster is installed.

Click to jump to top of pageClick to jump to parent topicThe “HelloWorld” Servlet

The test Java servlet named HelloWorld can be used to test custom content extensions. The following shows the source for this servlet.

//******************************************************************/ // Confidentiality Information: / // / // This module contains confidential and proprietary information / // of PeopleSoft, Inc.; it is not to be copied, reproduced, or / // transmitted in any form, by any means, in whole or in part, / // nor is it to be used for any purpose other than that for / // which it is expressly provided under the applicable license / // agreement. / // / // Copyright (c) 2000-2002 PeopleSoft, Inc. All Rights Reserved. / //******************************************************************/ /*--- formatted by Jindent 2.1, (www.c-lab.de/~jindent) ---*/ package com.peoplesoft.crm.omk.external; import java.io.PrintWriter; /** * HelloWorld servlet simply outputs the string "Hello World!" */ public class HelloWorld extends GenericAnnuncioServlet { /** * HelloWorld constructor. */ public HelloWorld() { super(); } /** * Retrieves the servlet info string * @return String the servlet info string */ public String getServletInfo() { return ("HelloWorld, Annuncio Software, 4/2000"); } /** * service method. */ public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, java.io.IOException { PrintWriter out = res.getWriter(); if (out != null) { out.print("Hello World!"); } else { System.err.println("Can't get a PrintWriter."); } } } /*--- formatting done in "Annuncio Convention" style on 06-20-2000 ---*/

Click to jump to top of pageClick to jump to parent topicThe “SampleLiveExtension” Servlet

The SampleLiveExtension servlet is a custom content extension that builds HTML on a web page based on a content’s profile information. It shows how to achieve the following operations:

This section is divided into the following subsections:

Audience

The audience for this extension consists of users who want to understand Online Marketing Extensions and those who want to write them.

Warning! This extension is provided as an example only; it should never be used in a production dialog.

Functionality

The SampleLiveExtension servlet expects the following parameters:

Name

Description

path

The path where the files containing the content are stored. This parameter should be set in the Extension Registration's parameter list but can be overridden at the moment of the call.

firstName

The first name of the contact. This parameter should be merge content.

state

The state where the contact lives. This parameter should be merge content.

refresh

(Optional) Set this parameter to true if you want to force the data to be reloaded from the file and not read from cache. This parameter should be set in the Extension Registration's parameter list.

refreshTime

The content to display is refreshed every day at this time. If not specified or invalid, the default time used is midnight. This parameter must be defined in the Extension Registration's parameter list and cannot be overridden when you call the function. The allowed formats are HH:MM (24 hour format) or HH:MM AM|PM (12 hour format).

The servlet displays the following message:

Content Storage

The servlet expects that the content is stored in files. The path of the files must be specified in the path parameter. File names should be in the following format:

<path_value>\<state_abbreviation>.txt

For example, if the path is equal to C:\states\ and the state is California, the data would be searched in the following file:

C:\states\CA.txt

The content of each state data file is expected to be a list of key/value pairs. The following keys are searched and merged into the document:

A valid file would look similar to this:

Population=33,145,121 inhabitants Area=158,869 square miles Senators=Barbara Boxer, Dianne Feinstein

All information available in the file will be displayed on the web page.

Cache Mechanism

To limit the number of disk accesses, the content of each file is kept in memory after being read. However, two mechanisms are implemented to allow the update of the data:

Note. The use of the refresh parameter only refreshes the cache on the Online Marketing component where the servlet is executed—this can be the Online Marketing Dialog Server (for web page content) or a Mailcaster (for email content).

Registering the Extension

Before you can use the SampleLiveExtension servlet, you must register it.

Note. The design of the SampleLiveExtension servlet is more appropriate for usage as a custom content extension within a web page. However, it can also be used as a custom content extension within an email. The following registration instructions allow the registration of the servlet on the Online Marketing Dialog Execution Server, which is used to display web page content. If you want to use the extension with email, you must register the function on all the Mailcasters. (In this case, step 1 in the following instructions must be done only once in Extension Registration, but steps 2 and 3 must be done for each component that will call the extension.)

Follow these instructions to register the servlet:

  1. Navigate to the Extension Registration Page for Java servlets and add the servlet SampleLiveExtension. Set the following parameter values within it:

    Name

    Value

    Servlet Class Name

    com.peoplesoft.crm.omk.external.CFlibrary.SampleLiveExtension

    path

    The path where you will store the files containing the content. You must include a final backslash (\) for Windows or slash (/) for Solaris, for example:

    C:\states\

    or

    /usr/foo/states/

    refreshTime

    The time when you want the content to be refreshed each day.

  2. Change the status to Active and save the changes.

  3. After you have finished, restart the Dialog Execution Server.

  4. If you are calling the extension from an email, restart the Mailcasters that will call this extension.

See Register the Extension in Online Marketing.

See PeopleSoft Online Marketing User Guide.

Using the Extension

One of the simplest dialogs that allows you to use the SampleLiveExtension servlet is composed of the following:

The call to the Online Marketing Extension would look like this:

<pstag:extension name="SampleLiveExtension" id="a number">

You can use the previous example as a model.

Hint: You can associate the refresh parameter with the value of a Yes/No document field on the landing field so you can easily see its effects.

After the files with the content have been created, you can set the dialog to Live (or In Test), generate a link report, and try out the functionality of the Online Marketing extension.

Click to jump to top of pageClick to jump to parent topicAdditional Sample: EXStockQuotes

An additional sample servlet, EXStockQuotes, is also provided. It is similar to the SampleLiveExtension servlet.

You can use the EXStockQuotes servlet in three different ways within Online Marketing dialogs:

In the third scenario the extension is used to retrieve content posted at an external URL, while the conditions specifying which content is to be displayed to whom are set up within the Dynamic Content object (in Online Marketing). Typically in this case, as in this sample, one or two parameters would be passed to retrieve the appropriate content. Each Content Section of the Dynamic Content object could have an extension inserted to retrieve content, or the Dynamic Content object could have a mix where some Content Sections have internally-stored content (content that is inserted or copy/pasted into the Content tab) while other Content Sections have an extension designed to retrieve content.

See Also

The “SampleLiveExtension” Servlet