Notification Classes

This chapter provides an overview of the Notify classes and discusses the following topics:

Click to jump to parent topicUnderstanding Notification Classes

The Notification classes are used for ad-hoc notification. These classes enable you to create and send a notification to someone. The notifications can either be a Peoplesoft Worklist item or an SMTP email message. The Notification class also stores notifications in a table.

You can also use web services to create Worklist entries, then send notifications of completion using application messages.

The Notification classes can be called from a component, an internet script, or an Application Engine program. The WSWorklistEntry class can be used incase you are developing your own PT_WORKLIST notification handler. .

Most of the classes, as well as most of the properties and methods that make up the Notification classes have a GUI representation in Peoplesoft Workflow. This document assumes that the reader is familiar with PeopleSoft Workflow.

See Also

Understanding PeopleSoft Workflow

Click to jump to parent topicScope of the Notification Classes

The Notification classes can be called from a component, an internet script, Integration Broker, or an Application Engine program.

Notification classes can be of Local, Global, or Component scope.

Click to jump to parent topicData Types of the Notification Classes

Every Notification class is its own data type, that is, Notifications are declared as data type Notification, Notification addresses are declared as type NotificationAddress, and so on.

The following are the data types of the Notification classes:

Click to jump to parent topicHow to Import the Notification Classes

The Notification classes are not built-in classes, like Rowset, Field, Record, and so on. They are application classes. Before you can use these classes in your PeopleCode program, you must import them to your program.

An import statement names either all the classes in a package or one particular application class. For importing the Notification classes, PeopleSoft recommends that you import all the classes in the application package.

The application package PT_WF_NOTIFICATION contains the following classes:

The application package PT_WF_WORKLIST contains the following classes:

The import statements you should use are as follows:

import PT_WF_NOTIFICATION:*; import PT_WF_WORKLIST:*;

Using the asterisks after the package name makes all the application classes directly contained in the named package available. Application classes contained in subpackages of the named package are not made available.

See Also

Application Classes

Click to jump to parent topicHow to Create a Notification Object

After you've imported the Notification classes, you instantiate an object of one of those classes using the constructor for the class and the Create function.

The following example creates a new instance of the WorklistEntry class, as the variable &MyWE, with local scope:

Local WorklistEntry &MyWE = Create WorklistEntry();

See Also

Notification Classes Constructors

Click to jump to parent topicNotification Classes Constructors

You must use the constructor for each class to instantiate an instance of that class. The following are the constructors for the Notification classes.

Click to jump to top of pageClick to jump to parent topicNotification

Syntax

Notification(NotifyFrom, dttmCreated, language_cd)

Description

Use Notification to instantiate a notification object.

Parameters

NotifyFrom

Specify the entity the notification is being sent from, as a string. Avoid overusing generic entities with this parameter, as this value, along with the value for dttmCreated are the key to understanding where notifications originated from.

dttmCreated

Specify the date and time the notification is being sent, as a DateTime value.

Important! To ensure a unique timestamp for each notification that is sent, you must pass a DateTime value that includes milliseconds. Because the %Datetime system variable always returns 0 for the milliseconds value, use the combination of %Date+%PerfTime instead.

language_cd

Specify the 3-character language code of the current user, as a string.

Returns

A Notification object.

Example

To ensure a unique timestamp for each notification that is sent, you must pass a DateTime value that includes milliseconds to the dttmCreated parameter. Because the %Datetime system variable always returns 0 for the milliseconds value, use the combination of %Date+%PerfTime instead.

import PT_WF_NOTIFICATION:*; import PT_WF_WORKLIST:*; Local PT_WF_NOTIFICATION:Notification &MyNotify; &MyNotify = create PT_WF_NOTIFICATION:Notification("Workflow_Admin", ⇒ %Date + %PerfTime, %Language);

See Also

Notification Class.

Click to jump to top of pageClick to jump to parent topicNotificationAddress

Syntax

NotificationAddress(Oprid, Description, Language, EmailId, Channel)

Description

Use NotificationAddress to instantiate a notification address.

This address is used to build a notification using the Notification class. This class is required if you want to use the Notification data type.

Parameters

Oprid

Specify the user ID of the person receiving the notification, as a string.

Description

Specify the description of the entity receiving the notification (distribution group names, people's names, and so on) as a string.

Language

Specify the language code of the entity to be notified as a string.

EmailId

Specify the email address as a string.

Channel

Specify the 'channel' used for the notification, as a string. The values are:

 

Value

Description

Email

Notification is sent as email

Worklist

Notification is sent as a worklist

Returns

None.

Example

import PT_WF_NOTIFICATION:*; import PT_WF_WORKLIST:*; Local NotificationAddress &MyNotify_Addy; &MyNotify_Addy = Create NotificationAddress(%UserID, &Description, %Language,⇒ &EmailID, &Channel);

See Also

NotificationAddress Class.

Click to jump to top of pageClick to jump to parent topicNotificationTemplate

Syntax

NotificationTemplate(ComponentId, Market, TemplateId, TemplateType)

Description

Use NotificationTemplate to instantiate a notification template.

If you're specifying a generic template, the first two parameters do not have to have values, that is, you must specify a Null string ("") instead.

Parameters

ComponentId

Specify the name of the component the notification is coming from as a string. To specify a generic template, you must specify a Null string ("") for this value instead.

Market

Specify the name of the market of the component the notification is coming from as a string. To specify a generic template, you must specify a Null string ("") for this value instead.

TemplateId

Specify the template ID as a string.

TemplateType

Specify the type of template as a string. Values are:

  • G: generic template

  • C: component template

Returns

An instance of the NotificationTemplate class.

Example

import PT_WF_NOTIFICATION:*; import PT_WF_WORKLIST:*; Local NotificationTemplate &Notify_Temp; /* create a generic template */ &Notify_Temp = Create NotificationTemplate("", "", "MyTemplate", "G");

See Also

NotificationTemplate Class.

Click to jump to top of pageClick to jump to parent topicWorklist

Syntax

Worklist()

Description

Use the Worklist method to instantiate a Worklist object.

Parameters

None.

Returns

An instance of the Worklist class.

Example

The following example code creates a worklist.

import PT_WF_WORKLIST:*; Local Worklist &theWorklist = Create Worklist();

See Also

Worklist Class

Click to jump to top of pageClick to jump to parent topicWorklistEntry

Syntax

WorklistEntry()

Description

Use WorklistEntry to instantiate a WorklistEntry object.

Parameters

None.

Returns

An instance of the WorklistEntry class.

Example

import PT_WF_NOTIFICATION:*; import PT_WF_WORKLIST:*; Local WorklistEntry &MyWorklistEntry = Create WorklistEntry();

See Also

WorklistEntry Class.

Click to jump to top of pageClick to jump to parent topicWSWorklistEntry

Syntax

WSWorklistEntry()

Description

Use the WSWorklistEntry constructor to instantiate a WSWorklistEntry object.

The WSWorklistEntry class is primarily used with web services.

Parameters

None.

Returns

A reference to a WSWorklistEntry object.

See Also

WSWorklistEntry Class

Click to jump to parent topicNotification Class

This class is used to send a notification to people or people entities, as channel independent as possible. This enables functionality such as letting a user determine how to receive workflow notifications as a preference. It does not necessarily limit a person or entity to one channel.

See Notification Classes Examples.

See Using Notification Templates.

Click to jump to parent topicNotification Class Import Statements

The Notification class imports the following classes:

Here are the import statements:

import PT_WF_NOTIFICATION:NotificationAddress; import PT_WF_WORKLIST:WorklistEntry;

Click to jump to parent topicNotification Class Method

In this section, we discuss the Notification class method Send.

Click to jump to top of pageClick to jump to parent topicSend

Syntax

Send()

Description

Use the Send method to send a notification to the entities defined in the NotifyTo, NotifyCC, and NotifyBCC, using the Subject and Message properties.

Parameters

None.

Returns

None.

See Also

Understanding PeopleSoft Workflow.

Click to jump to parent topicNotification Class Properties

In this section, we discuss the Notification class properties. The properties are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicContentType

Description

This property returns the content type of the value specified by the Message property, as a string. This property is used only with email Notifications, that is, with SMTP email.

This property is read-write.

See Also

Notification class: Message property.

Click to jump to top of pageClick to jump to parent topicdttmCreated

Description

This property returns the Datetime the notification created as a datetime value. Together with NotifyFrom this makes a notification unique.

See Also

Notification class: NotifyFrom property.

Click to jump to top of pageClick to jump to parent topicEmailReplyTo

Description

If an email is sent as a result of the Send method, this property returns the email reply that should be used, as a string. This property can have a different value from NotifyFrom. This property is valid only with notifications that have "email" specified as the channel.

This property is read-write.

See Also

Notification class: Send method, NotifyFrom property.

Click to jump to top of pageClick to jump to parent topicFileNames

Description

This property returns an array of string, populated with the names of any file attachments sent with the notification. This property is valid only with notifications that have "email" specified as the channel.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicFileTitles

Description

This property returns an array of string, populated with descriptions of any file attachments. The array order must be respective to the array order for FileNames, that is, file description matches file name one by using the same array index value. This property is valid only with notifications that have "email" specified as the channel.

This property is read-write.

See Also

Notification class: FileNames property.

Click to jump to top of pageClick to jump to parent topiclanguage_cd

Description

This property returns the 3-character language code used for the notification, as a string. This is used for tracking purposes.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicMessage

Description

This property returns the text of the message sent with the notification as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicNotifyBCC

Description

This property returns an array of NotificationAddress objects, populated with the email addresses or worklist users of the people the notification is sent to. This list is used for notification information only, that is, the people on this list are generally not responsible for taking action specified by the notification. In addition, when you use the Notification Send method, other recipients cannot see the email addresses and or users that make up this array.

If you want to send a regular CC list, that is, one where the members of the list can see each other, use the NotifyCC property instead.

See Also

Notification class: NotifyCC property.

Click to jump to top of pageClick to jump to parent topicNotifyCC

Description

This property returns an array of NotificationAddress objects, populated with the email addresses of the people the notification is sent to. This list is used for notification information only, that is, the people on this list are generally not responsible for taking action specified by the notification. When using the Notification Send method, the email address or worklist users of this array are exposed to the recipients of the notification.

If you want to send a blind-CC list, that is, where the members of the list cannot see each other, use the NotifyBCC property instead.

See Also

Notification class: NotifyBCC property.

Click to jump to top of pageClick to jump to parent topicNotifyFrom

Description

This property returns the ID of the entity sending the notification as a string. For example, ad-hoc workflow uses the current user ID.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicNotifyGuid

Description

This property returns the GUID of the notification. This is a unique identifier used for tracking purposes only.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicNotifyTo

Description

This property returns an array of NotificationAddress objects, populated with the email addresses of the people the notification is sent to, and who are responsible for taking action if necessary.

To send the list to additional people, use the NotifyCC or NotifyBCC properties.

See Also

Notification class: NotifyCC property, NotifyBCC property.

Click to jump to top of pageClick to jump to parent topicRte

Description

Use this property to set or return a Boolean value indicating whether to use Rich Text formatting in the notification.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSourceComponent

Description

This property returns the name of the source component, that is, that initiated the notification process. This property is used for transaction tracking purposes only. This property is not required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSourceMarket

Description

This property returns the name of the market of the source component, that is, that initiated the notification process. This property is used for transaction tracking purposes only. This property is not required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSourceMenu

Description

This property returns the name of the menu of the source component, that is, that initiated the notification process. This property is used for transaction tracking purposes only. This property is not required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSubject

Description

This property returns the subject used in the email notification as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicTemplate

Description

If the notification message originated from a template, this property returns the name of that template, as a string. This property is used for transaction tracking purposes only. This property is not required.

This property is read-write.

Click to jump to parent topicNotificationAddress Class

The main purpose of the NotificationAddress is to define an entity to a 'channel', it is concerned at a high level only that a notification was sent.

See Notification Classes Examples.

See Using Notification Templates.

Click to jump to parent topicNotificationAddress Class Properties

In this section, we discuss the NotificationAddress class properties. The properties are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicChannel

Description

This property returns the 'channel' used for the notification, as a string. The values are:

Value

Description

Email

Notification is sent as email.

Worklist

Notification is sent as a worklist.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicDescription

Description

This property returns the description of the entity as a string. Entity descriptions include distribution group names or people's names.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicEmailId

Description

This property returns the Email Address of the entity to be notified.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicLanguage

Description

This property returns the language code of the entity to be notified.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicOprid

Description

This property returns the user ID of the person receiving the notification as a string.

This property is read-write.

Click to jump to parent topicNotificationTemplate Class

This class is useful for populating the message property of the Notification class.

See Using Notification Templates.

Click to jump to parent topicNotificationTemplate Class Methods

In this section, we discuss the NotificationTemplate class methods. The methods are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicGetAndExpandTemplate

Syntax

GetAndExpandTemplate(Language, Vars)

Description

Use the GetAndExpandTemplate method to expand and map the variables into the Text property of the template.

If this is a component template, you must use the SetupCompVarsAndRcpts method first, before you use this method.

If this is a generic template, you must use the SetupGenericVars method first, before you use this method.

The value returned by the Setup methods must be used as the second parameter for this method.

Parameters

Language

Specify the 3-character language code used with the notification.

Vars

Specify the variable representing the XML string returned by either the SetupCompVarsAndRcpts method or the SetupGenericVars method.

Returns

Returns a Boolean value: True if the template expanded properly, False otherwise.

Example

import PT_WF_NOTIFICATION:NotificationTemplate; Local NotificationTemplate & mynotifytemplate; &mynotifytemplate = create NotificationTemplate(%Component, %Market, &template⇒ Name, "C"); &xmlVars = &mynotifytemplate.SetupCompVarsAndRcpts(GetLevel0()); &mynotifytemplate.GetAndExpandTemplate(%Language, &xmlVars);

See Also

NotificationTemplate class: SetupCompVarsAndRcpts method, SetupGenericVars method.

Click to jump to top of pageClick to jump to parent topicSetupCompVarsAndRcpts

Syntax

SetupCompVarsAndRcpts(&Rowset_Context)

Description

Use the SetupCompVarsAndRcpts method to set up variables for the component from the provided rowset. This method also sets up any additional recipients defined in the component.

The rowset corresponds to the component that the notification template was instantiated with. For example, if you created a notification template for JOB, the rowset used with this method should be based on the JOB component.

If you want to expand a component template, you must use this method first, before expanding the template.

Parameters

&Rowset_Context

Specify an already instantiated and populated rowset containing the necessary variables.

Returns

A string containing XML that is used by the GetAndExpandTemplate method.

Example

import PT_WF_NOTIFICATION:NotificationTemplate; Local NotificationTemplate & mynotifytemplate; &mynotifytemplate = create NotificationTemplate(%Component, %Market, &template⇒ Name, "C"); &xmlVars = &mynotifytemplate.SetupCompVarsAndRcpts(GetLevel0()); &mynotifytemplate.GetAndExpandTemplate(%Language, &xmlVars);

See Also

NotificationTemplate class: GetAndExpandTemplate method.

Click to jump to top of pageClick to jump to parent topicSetupGenericVars

Syntax

SetupGenericVars(&AryValues)

Description

Use the SetupGenericVars method to pass values to a generic template.

To expand a generic template, you must use this method first, before expanding the template.

Parameters

&AryValues

Specify an array of string containing values used with the expanded template.

Returns

A string containing XML that is used by the GetAndExpandTemplate method.

Example

import PT_WF_NOTIFICATION:NotificationTemplate; . . . &mynotifytemplate = create NotificationTemplate("","", "MYTEMPLATE", "G"); /* Populate an array to contain the values needed by */ /* the template */ &aryValues = CreateArrayRept("", 0); &aryValues.Push("FIRST VALUE"); &aryValues.Push("SECOND VALUE"); &xmlVars = &mynotifytemplate.SetupGenericVars(&aryValues); &mynotifytemplate.GetAndExpandTemplate(%Language, &xmlVars);

See Also

NotificationTemplate class: GetAndExpandTemplate method.

Click to jump to parent topicNotificationTemplate Class Properties

In this section, we discuss the NotificationTemplate class properties. The properties are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicComponentId

Description

This property returns a component for the component type notification template as a string. This is not required for generic templates.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicInstruction

Description

This property returns the notification instructions as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicLanguage

Description

This property returns the language used to retrieve template descriptions, as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicMarket

Description

This property returns the market for component type notification templates as a string. This is not required for generic templates.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicPriority

Description

This property returns the priority of the notification template as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicResponses

Description

This property is populated only if there are any RIMM responses.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSubject

Description

This property returns the subject of the notification template as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicTemplateId

Description

This property returns the template ID as a string. If you are creating a notification template, this property is always required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicTemplateType

Description

This property returns the template type as a string. Values are:

Value

Description

C

Component

G

Generic

If you are creating a notification template, this property is always required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicText

Description

This property returns the Template Text as a string.

This property is read-write.

Click to jump to parent topicWorklist Class

The Worklist class is used to make mass modifications to worklist instances. Modifications to one worklist instance should be performed through the WorklistEntry class.

See Worklist.

Click to jump to parent topicWorklist Class Method

In this section, we discuss the Worklist class method Reassign.

Click to jump to top of pageClick to jump to parent topicReassign

Syntax

Reassign(FromOperid, ToOperid)

Description

Use the Reassign method to reassign all worklist items with a state less than “Worked” from one user to another.

If you only want to reassign a single worklist entry, use the Reassign WorklistEntry class method.

Parameters

FromOperid

Specify the user ID of the user from which you want to assign a worklist, as a string.

ToOperid

Specify the user ID of the user to which you want to assign a worklist, as a string.

Returns

A Boolean value: true if worklist was assigned successfully, false otherwise.

See Also

Reassign

Click to jump to parent topicWorklistEntry Class

This class is used to create and or update a worklist entry.

See Creating a WorklistEntry.

See Updating a WorklistEntry.

See Understanding PeopleSoft Workflow.

Click to jump to parent topicWorklistEntry Class Methods

In this section, we discuss the WorklistEntry class methods. The methods are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicCreate

Syntax

Create()

Description

Use the Create method to create a new WorklistEntry object.

This method is not the same as the Create constructor. The Create constructor only creates an instance of the WorklistEntry class. To add the entry to the database, you must use this method.

The following properties must be set before calling this method:

If this method completes successfully, the following properties are populated:

Parameters

None.

Returns

This method returns a numeric value: 0 if there is an error, nonzero if entry created successfully.

Example

import PT_WF_WORKLIST:*; Local WorklistEntry &worklist; Local Number &Rslt; &worklist = create WorklistEntry(); &worklist.busprocname = "Administer Workflow"; &worklist.busactivity = "Send Note"; &worklist.buseventname = "Worklist Note"; &worklist.worklistname = "Worklist Note"; &Rslt = &worklist.Create();

See Also

WorklistEntry class: busactivity property, buseventname property, busprocname property, instanceid property, transactionid property.

Click to jump to top of pageClick to jump to parent topicGetResponseStatus

Syntax

GetResponseStatus()

Description

Use the GetResponseStatus method to return the response status of the callback method. This is useful only for entries that are created by web services.

The following properties must be set before calling this method:

Parameters

None.

Returns

A number. Valid values are:

Value

Description

0

CreateWorklistEntry message not received yet or this entry was not created by any web service.

1

Message received but not processed yet.

2

Message processed and sent to message queue.

3

Error while sending message to the caller of create worklist entry.

4

Message was sent to the originating web server and was received successfully.

Click to jump to top of pageClick to jump to parent topicReassign

Syntax

Reassign(Operid)

Description

The Reassign method assigns the worklist in the data buffers to the user specified by Operid. This method commits the version of the worklist entry in the data buffer to the database using the Save method.

If you want to reassign an entire worklist, use the Reassign Worklist class method.

Note. You must use the SelectByKey method to populate data buffers with the worklist entry.

Parameters

Operid

Specify the user ID to which you want to assign the worklist entry, as a string.

Returns

A Boolean value: true if the reassignment was successful, false otherwise.

Example

import PT_WF_WORKLIST:WorklistEntry; Local WorklistEntry &wl = create WorklistEntry(); &wl.busprocname = WF_WORKLIST_VW2.BUSPROCNAME; &wl.busactivity = WF_WORKLIST_VW2.ACTIVITYNAME; &wl.buseventname = WF_WORKLIST_VW2.EVENTNAME; &wl.worklistname = WF_WORKLIST_VW2.WORKLISTNAME; &wl.instanceid = WF_WORKLIST_VW2.INSTANCEID; If (&wl.SelectByKey()) Then If Not (&wl.Reassign("TOPSUSER2")) Then /* Reassign error */ End-If; Else /* SelectByKey error */ End-If;

See Also

Reassign

Click to jump to top of pageClick to jump to parent topicSave

Syntax

Save()

Description

Use the Save method to save a WorklistEntry to the database.

PeopleCode Event Considerations

You must include this method within events that allow database updates. This includes the following PeopleCode events:

If this method results in a failure, all database updates are rolled back. All information the user entered into the component is lost, as if the user pressed ESC.

Considerations Using Web Services

This method saves the instance of the worklist to the database. If the worklist entry is marked as worked, (that is, if inststatus property is set to 2) and the worklist entry was originally created by a web service, the originating requestor is sent a response when this method is executed. If the requestor is expecting additional data, use the SaveWithCustomData method instead.

Parameters

None.

Returns

A numeric value: 0 if save didn't complete successfully, nonzero if save completed successfully.

Example

If (&worklist.Save() <> 0) Then /* success */ Else /* handle error */ End-If;

See Also

WorklistEntry class: Update method.

SaveWithCustomData

inststatus

Click to jump to top of pageClick to jump to parent topicSaveWithCustomData

Syntax

SaveWithCustomData(&Message, &FieldNameArray, &FieldValueArray)

Description

Use the SaveWithCustomData method to save the worklist entry to the database, as well as to pass additional data back to the requestor that created this worklist entry. You should only use this method with worklist entries that are created by web service. If you want to save a worklist entry without additional data, or a worklist entry that was not created using a web service, use the Save method instead.

If the worklist entry was not created by a web service, or if the worklist entry is not marked as worked (that is, if the inststatus property is not set to 2,) the additional data is ignored.

PeopleCode Event Considerations

You must include this method within events that allow database updates. This includes the following PeopleCode events:

If this method results in a failure, all database updates are rolled back. All information the user entered into the component is lost, as if the user pressed ESC.

Parameters

&Message

Specify an already instantiated and populated response message containing the custom data to be sent back to the originating web service.

&FieldNameArray

Specify an already instantiated and populated array of string containing the field names to be used by the web service that created the worklist entry.

&FieldValueArray

Specify an already instantiated and populated array of string containing matching field values to be used by the web service that created the worklist entry.

Returns

A message object containing the final message that was sent to the web service if successful, a null object otherwise.

See Also

Save

inststatus

Click to jump to top of pageClick to jump to parent topicSelectByKey

Syntax

SelectByKey()

Description

The SelectByKey method uses the key field values that have been assigned to build and execute a Select SQL statement. The field values are then fetched from the database SQL table into the worklist entry and the Select statement is closed.

If you don’t specify all the key fields, those you exclude are added to the Where clause with the condition equal to a blank value. If not all keys are set and more than one row is retrieved, you won't receive an error and SelectByKey won’t fetch any data.

For worklist entries that were created by web services, use the SelectByMessageId method instead.

Parameters

None.

Returns

A Boolean value: true if the properties are set based on the database values, false otherwise.

See Also

SelectByMessageId

Click to jump to top of pageClick to jump to parent topicSelectByMessageId

Syntax

SelectByMessageId()

Description

Use the SelectByMessageId method to select a worklist entry by the message id. This is useful only for entries that are created by web services.

The following properties must be set before calling this method:

Parameters

None.

Returns

A Boolean value: true if this method completes successfully, false otherwise.

See Also

WorklistEntry class: SelectByKey method.

Click to jump to top of pageClick to jump to parent topicUpdate

Syntax

Update()

Description

Use the Update method to update the worklist entry with any property values that have changed, and assign values to the associated record in the database. However, this method does not commit the changes to the record in the database. You must use the Save method to update the database.

Parameters

None.

Returns

A numeric value: 0 if update didn't complete successfully, nonzero if update completed successfully.

Example

If (&worklist.Update() <> 0) Then &worklist.inststatus = "2" /* mark entry worked */ /* additional processing */ End-if;

See Also

WorklistEntry class: Save method.

Click to jump to parent topicWorklistEntry Class Properties

In this section, we discuss the WorklistEntry class properties. The properties are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicactiondttm

Description

This property returns the Worklist action datetime as a datetime.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicbusactivity

Description

This property returns the source activity name of the source business process as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicbuseventname

Description

This property returns the source event name of the source activity as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicbusprocname

Description

This property returns the source business process name as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topiccommentshort

Description

This property returns the short comment the previous user ID gave when reassigning a worklist as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicdo_replicate_flag

Description

This property returns a flag that indicates if the worklist entry must be replicated. Values are:

Value

Description

Y

Worklist entry needs to be replicated

N

Worklist entry does not need to be replicated

This property is read-write.

Click to jump to top of pageClick to jump to parent topicinstanceid

Description

This property returns the Instance Id. This property is used with the following properties to make the worklist entry a unique number:

This property is read-write.

Click to jump to top of pageClick to jump to parent topicinstselecteddttm

Description

This property returns the datetime that the worklist was selected to be worked as a datetime value.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicinststatus

Description

This property returns the Worklist Entry status as a string. The values are:

Value

Description

0

new worklist entry

1

selected worklist entry

2

worked worklist entry

3

cancel string

This property is read-write.

Click to jump to top of pageClick to jump to parent topicinsttimeoutddttm

Description

This property returns the datetime the worklist entry timed out. Only some worklist types use this property.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicinstworkeddttm

Description

This property returns the datetime worklist was worked as a datetime value.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicIsCreatedViaWebService

Description

This property returns a Boolean value: true if the WorklistEntry object was created from a web service, false otherwise.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicoprid

Description

This property returns the user ID that is assigned the worklist as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicoriginatorid

Description

This property returns the user ID that caused the worklist to be created as a string.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicprevoprid

Description

This property returns the previous user ID who used this worklist entry as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicrequestmessageid

Description

This property is used with worklist entries that are created by web services. It contains the original message ID from the requesting party.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicResponseStatus

Description

This property returns the status of the response sent to the originating web service.

Valid values are:

Value

Description

0

CreateWorklistEntry message not received yet or this entry was not created by any web service.

1

Message received but not processed yet.

2

Message processed and sent to message queue.

3

Error while sending message to the caller of create worklist entry.

4

Message was sent to the originating web server and was received successfully.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicsyncid

Description

This property is reserved for future use.

This property is read-write.

Click to jump to top of pageClick to jump to parent topictimedout

Description

This property returns the status flag if the worklist has timed out. Values are:

Value

Description

Y

Worklist has timed out

N

Worklist has not timed out

This property is read-write.

Click to jump to top of pageClick to jump to parent topictransactionid

Description

This property returns the transaction Id as a number, which represents the unit of work. This can be useful for pooled worklists.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicurl

Description

This property returns the URL to work for the worklist as a string. This is used only for replicating worklist entries across PeopleSoft databases.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicwl_priority

Description

This property returns the priority of the worklist as a string. The values are:

Value

Description

low

Worklist has low priority.

medium

Worklist has medium priority.

high

Worklist has high priority.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicwldaystoselect

Description

This property returns the number of days to select worklist as a number.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicwldaystowork

Description

This property returns the number of days to work the worklist as a number.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicworklistname

Description

This property returns the source worklist name for the source event string as a string.

This property is read-write.

Click to jump to parent topicWSWorklistEntry Class

This class is used by web services to create Worklist entries.

This class implements the Integration Broker class IRequestHandler.

See Also

Sending and Receiving Messages

Click to jump to parent topicWSWorklistEntry Class Methods

The following are the WSWorklistEntry class methods, in alphabetical order.

Click to jump to top of pageClick to jump to parent topicOnError

Syntax

OnError(&Message)

Description

Use the OnError method to do error handling. This method implements the Integration Broker IRequestHandler interface OnError method.

Parameters

&Message

Specify an already instantiated and populated message object. This would normally be the message that was used to generate the worklist entry from the web service.

Returns

Depends on implementation.

See Also

Message Classes

SOAPDoc Class

Sending and Receiving Messages

Click to jump to top of pageClick to jump to parent topicOnNotify

Syntax

OnNotify(&Message)

Description

Use the OnNotify method to creates the worklist entry and the application worklist record.

This method implements the Integration Broker INotificationHandler interface OnNotify method.

Parameters

&Message

Specify an already instantiated and populated message object. Generally this would be the originating message that created the worklist entry.

Returns

None.

See Also

Sending and Receiving Messages

Click to jump to parent topicWSWorklistEntry Class Properties

The following describes the WSWorklistEntry class properties, in alphabetical order.

Click to jump to top of pageClick to jump to parent topicInstanceID

Description

This property returns the instance ID for the worklist entry, as a string.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicTransactionID

Description

This property returns the transaction ID for the worklist entry, as a string.

This property is read-only.

Click to jump to parent topicNotification Classes Examples

The following are example of typical actions you perform using the notification classes.

See Using Notification Templates.

Click to jump to top of pageClick to jump to parent topicCreating a WorklistEntry

The following example creates a WorklistEntry.

The following is the complete code sample: the steps explain each line.

import PT_WF_WORKLIST:*; Local WorklistEntry &worklist; &worklist = create WorklistEntry(); &worklist.busprocname = "Administer Workflow"; &worklist.busactivity = "Send Note"; &worklist.buseventname = "Worklist Note"; &worklist.worklistname = "Worklist Note"; If (&worklist.Create() <> 0) Then &worklist.oprid = %UserId; Else /* handle error */ End-If; If (&worklist.Save() <> 0) Then /* success, create a corresponding row in */ /* application worklist record... */ Else /* handle error */ End-If;

To create a WorklistEntry:

  1. Import the WorklistEntry class.

    You must import the WorklistEntry class before you can use it in your PeopleCode program. In addition, the second line declares the variable &worklist as type WorklistEntry.

    import PT_WF_WORKLIST:*; Local WorklistEntry &worklist;

  2. Instantiate a WorklistEntry object.

    Using the constructor, create an instance of the WorklistEntry class. This does not create a WorklistEntry. This creates a WorklistEntry object only. You must use the Create method to actually create the WorklistEntry in the system.

    &worklist = create WorklistEntry();

  3. Set the required parameters.

    Some of the WorklistEntry class properties are required for every WorklistEntry. You must set a value for these properties before you can update or save the WorklistEntry.

    &worklist.busprocname = "Administer Workflow"; &worklist.busactivity = "Send Note"; &worklist.buseventname = "Worklist Note"; &worklist.worklistname = "Worklist Note";

  4. Create the WorklistEntry.

    After you've set the required values, you need to create the WorklistEntry in the system. This does not update the database. This does, however, add values to the notification tables.

    If this method completes successfully, the following properties are populated: instanceid and transactionid.

  5. Save the WorklistEntry.

    After you've created the WorklistEntry, save it. The Save method actually updates the database, and so can be used only in events that allow database updates.

    If (&worklist.Save() <> 0) Then /* success, create a corresponding row in */ /* application worklist record... */ Else /* handle error */ End-If;

Click to jump to top of pageClick to jump to parent topicUpdating a WorklistEntry

The following example updates a WorklistEntry so that it is considered worked.

The following is the complete code sample: the steps explain each line.

import PT_WF_WORKLIST:*; Local WorklistEntry &worklist; &worklist = create WorklistEntry(); &worklist.busprocname = "Administer Workflow"; &worklist.busactivity = "Send Note"; &worklist.buseventname = "Worklist Note"; &worklist.worklistname = "Worklist Note"; &worklist.instanceid = 2; &ret = &worklist.SelectByKey(); &worklist.inststatus = "2"; /* mark entry worked */ If (&worklist.Update() <> 0) Then If (&worklist.Save() <> 0) Then /* success */ Else /* handle error */ End-If; Else /* handle error */ End-If;

To update a WorklistEntry:

  1. Import the WorklistEntry class.

    You must import the WorklistEntry class before you can use it in your PeopleCode program. In addition, the second line declares the variable &worklist as type WorklistEntry.

    import PT_WF_WORKLIST:*; Local WorklistEntry &worklist;

  2. Instantiate a WorklistEntry object.

    Using the constructor, create an instance of the WorklistEntry class. This does not create a WorklistEntry. This creates a WorklistEntry object only. You must use the Create method to actually create the WorklistEntry in the database tables, and the Save method to update the tables.

    &worklist = create WorklistEntry();

  3. Set the required parameters.

    Some of the WorklistEntry class properties are required for every WorklistEntry. You must set a value for these properties before you can update or save the WorklistEntry. The instanceid property, combined with the other properties, indicates a unique WorklistEntry. This value is populated after a WorklistEntry has already been created.

    &worklist.busprocname = "Administer Workflow"; &worklist.busactivity = "Send Note"; &worklist.buseventname = "Worklist Note"; &worklist.worklistname = "Worklist Note"; &worklist.instanceid = 2;

  4. Populate the worklist entry with data.

    After you've set the keys, populate the worklist entry based on those keys using the SelectByKey method.

    &ret = &worklist.SelectByKey();

  5. Update and save the WorklistEntry.

    After you've set the required parameters, try to update the WorklistEntry. If that is successful, mark the WorklistEntry as 'worked', and try to save the WorklistEntry. The Save method actually updates the database, and so can be used only in events that allow database updates.

    If (&worklist.Update() <> 0) Then &worklist.inststatus = "2" /* mark entry worked */ If (&worklist.Save() <> 0) Then /* success */ Else /* handle error */ End-If; Else /* handle error */ End-if;