PTNotification Class Methods
In this section, the PTNotification methods are described in alphabetical order.
Syntax
AddAction(Label, URL)
Description
Use the AddAction method to collate all the actions and to invoke the SetArrayOfActions of the PublishToWindow method.
Parameters
Parameter |
Description |
---|---|
Label |
Specifies the label of an action as a String value. |
URL |
Specifies the URL as a String value. |
Returns
None.
See AddAttachment.
See AddHeader.
Syntax
AddRecipient(recipient_type, value)
Description
Use this method to add a single recipient.
Parameters
Parameter |
Description |
---|---|
recipient_type |
Specifies the recipient type as a numeric value. Recipient types are as follows:
|
value |
Specifies the value for the selected recipient type, for example, PeopleSoft OPRID for operator. Specify a number in E164 format for external phone number. |
Returns
None.
Example
import PTNOTIFICATIONS:PTNotification;
Local object &objBroadcast = create PTNOTIFICATIONS:PTNotification("BROADCAST");
&objBroadcast.AddRecipient(1, "PTDMO");
&objBroadcast.AddRecipient(2, "Peoplesoft User");
&objBroadcast.AddRecipient(3, "external@peoplesoft.com");
&objBroadcast.AddRecipient(4, "+91000000000");
&objBroadcast.SetMessage("This is for demo", 0);
&objBroadcast.SetCategory("FYI");
&bRetCode = &objBroadcast.Send();
Syntax
AddRecipients(recipient_type, value)
Description
Use this method to add multiple recipients of the same type.
Parameters
Parameter |
Description |
---|---|
recipient_type |
Specifies the recipient type as a numeric value. Recipient types are as follows:
|
value |
Specifies the values for the recipient type as an array. Specify a number in E164 format for external phone number. |
Returns
None.
Syntax
DisableIndividualMail()
Description
Use this method to insert all the recipients in the To list and send one mail to all users based on the user preferences. If not, each user receives an individual mail.
Parameters
None.
Returns
None.
Syntax
GenerateKey()
Description
Use this method to generate a key, which should be used with the SetMsgKey method.
Parameters
None.
Returns
A string containing the generated key.
Syntax
GetFailedPhoneNumbers()
Description
Use this method to retrieve phone numbers to which text message could not be sent.
Parameters
None.
Returns
An array of string containing phone numbers.
Syntax
GetInvalidMailAddresses()
Description
Use this method to retrieve invalid mail addresses from the MCFOutboundEmail object.
Parameters
None.
Returns
A string containing mail address from the MCFOutboundEmail object.
Syntax
GetMailErrorDescription()
Description
Use this method to retrieve mail error description from the MCFOutboundEmail object.
Parameters
None.
Returns
A string containing error description from the MCFOutboundEmail object.
When multiple mails are sent, the errors could be logged in application logs, and this error string only mentions that the error descriptions are available in logs.
Syntax
GetMailErrorDetails()
Description
Use this method to retrieve mail error details from the MCFOutboundEmail object.
Parameters
None.
Returns
A string containing error details from the MCFOutboundEmail object.
When multiple mails are sent, the errors could be logged in application logs, and this error string only mentions that the error descriptions are available in logs.
Syntax
GetSentMailAddresses()
Description
Use this method to retrieve valid sent mail addresses from the MCFOutboundEmail object.
Parameters
None.
Returns
A string containing sent mail addresses (comma separated) from the MCFOutboundEmail object.
Syntax
GetSentToPhoneNumbers()
Description
Use this method to retrieve phone numbers to which text message is sent.
Parameters
None.
Returns
An array of string containing phone numbers.
Syntax
GetTextMsgCount()
Description
Use this method to retrieve the number of text messages that are sent successfully.
Parameters
None.
Returns
Number; the count of text messages sent successfully.
Syntax
GetUnsentMailAddresses()
Description
Use this method to retrieve valid mail addresses of messages that were not sent from the MCFOutboundEmail object.
Parameters
None.
Returns
A string containing comma separated mail addresses from the MCFOutboundEmail object.
Syntax
LogTextMessageSID(&bFlag)
Description
Use this method to specify whether to log SID for each text message that is sent. You can use the SID for troubleshooting.
Parameters
Parameter |
Description |
---|---|
&bFlag |
Specifies whether to log SID for each text message that is sent as a Boolean value. |
Returns
None.
Syntax
NotifyHeadersOnly()
Description
This method sets the StatusNotifyReturn property’s value to HDRS for mail; otherwise it sets the value to FULL.
Parameters
None.
Returns
None.
Syntax
NotifyOnDelay(&Flag)
Description
Use this method to specify whether the value of the StatusNotifyOptions property should be set to DELAY for email.
Parameters
Parameter |
Description |
---|---|
&Flag |
Specifies whether to set the value of the StatusNotifyOptions property to DELAY as a Boolean value. |
Returns
None.
Syntax
NotifyOnError(&Flag)
Description
Use this method to specify whether the value of the StatusNotifyOptions property should be set to FAILURE for email.
Parameters
Parameter |
Description |
---|---|
&Flag |
Specifies whether to set the value of the StatusNotifyOptions property to FAILURE as a Boolean value. |
Returns
None.
Syntax
NotifyOnSuccess(&Flag)
Description
Use this method to specify whether the value of the StatusNotifyOptions property should be set to SUCCESS for email.
Parameters
Parameter |
Description |
---|---|
&Flag |
Specifies whether to set the value of the StatusNotifyOptions property to SUCCESS as a Boolean value. |
Returns
None.
Syntax
PTNotification(Notification_name)
Description
PTNotification is a constructor method for the PTNotification class. Use PTNotification to instantiate an instance of the class.
The default event name is SENDNOTE.
Parameters
Parameter |
Description |
---|---|
Notification_name |
Specifies the notification as a String value. |
Returns
None.
Example
import PTNOTIFICATIONS:PTNotification;
Local object &objBroadcast = create PTNOTIFICATIONS:PTNotification("BROADCAST");
&objBroadcast.AddRecipient(1, "PTDMO");
&objBroadcast.AddRecipient(2, "Peoplesoft User");
&objBroadcast.AddRecipient(3, "external@peoplesoft.com");
&objBroadcast.AddRecipient(4, "+91000000000");
&objBroadcast.SetMessage("This is for demo", 0);
&objBroadcast.SetCategory("FYI");
&bRetCode = &objBroadcast.Send();
Syntax
Send()
Description
Use this method to send notifications as per user personalization.
Parameters
None.
Returns
A Boolean value. True if the notification is sent successfully; False otherwise.
Example
&bRetCode = &objBroadcast.Send();
Syntax
SetBounceTo(mail_ID)
Description
Use the method to specify the email address the system should direct all bounced mail to.
Parameters
Parameter |
Description |
---|---|
mail_ID |
Specifies the email address as a String value. |
Returns
None.
Syntax
SetCategory(Type)
Description
Use this method to specify a category for notifications.
Parameters
Parameter |
Description |
---|---|
Type |
Specifies the category for a notification as a String value. Valid values are:
|
Returns
None.
Example
&objBroadcast.SetCategory("FYI");
Syntax
SetMessage(message, channel)
Description
Use this method to set the message payload per channel. For mail channel, content type and encoding are configured separately.
Parameters
Parameter |
Description |
---|---|
message |
Specifies the message payload as a String value. |
channel |
Specifies the message channel as a Number value. The channels are as follows:
|
Returns
None.
Example
&objBroadcast.SetMessage("This is for demo", 0);
Syntax
SetMsgKey()
Description
Use this method to set a key for a message in In-app notifications. If a key is not provided, a key will be generated automatically through the GenerateKey method. The message key is required when you want to track the message and update the status for In-app notifications.
Parameters
None.
Returns
None.
Syntax
SetOnClickUrl(URL)
Description
Use this method to set the redirect URL.
Parameters
Parameter |
Description |
---|---|
URL |
Specifies the redirect URL as a String value. |
Returns
None.
Syntax
SetPriority(priority)
Description
Use this method to set the priority for In-app and mail notifications.
Parameters
Parameter |
Description |
---|---|
priority |
Specifies the priority for push and mail notifications as a Number. The priority values are as follows:
|
Returns
None.
Syntax
SetReplyTo(mail_ID)
Description
Use this method to specify the email address where the reply should be sent.
Parameters
Parameter |
Description |
---|---|
mail_ID |
Specifies the email address to send the reply as a String value. |
Returns
None.
Syntax
SetSender(mail_ID)
Description
Use this method to specify the email address of the author of the message.
Parameters
Parameter |
Description |
---|---|
mail_ID |
Specifies the sender’s email address as a String value. |
Returns
None.
Syntax
SetSMTPParam(parameter_name, parameter_value)
Description
Use this method to set parameters for the SMTP session to be used for sending the email.
Parameters
Parameter |
Description |
---|---|
parameter_name |
Specify the name of the parameter you want to overwrite as a String value. |
parameter_value |
Specify the value for the named parameter that you want used instead of the existing value as a String value.. |
Returns
None.
Syntax
SetSubject(Subject)
Description
Use this method to specify the subject of an email.
Parameters
Parameter |
Description |
---|---|
Subject |
Specifies the subject of mail notification as a String value. By default, the description in notification configuration is set as the subject of the mail notification, |
Returns
None.
Syntax
SetTimeToWait(wait_time)
Description
Use this method to specify the number of milliseconds to wait for the result of send email process. Default value from application server configuration.
Parameters
Parameter |
Description |
---|---|
wait_time |
Specifies the number of milliseconds. |
Returns
None.
Syntax
SetURLIdForText(&urlIdentifier)
Description
Use this method to overwrite the Twilio account details. By default, system uses the Twilio account configured on PeopleTools, Notification, Notification Administrator, Global Settings page.
If any application wants to use a different From Number, a new URLIdentifier can be configured and used by passing the URLID to this method.
Parameters
Parameter |
Description |
---|---|
&urlIdentifier |
Specifies the URL identifier as a String value. |
Returns
None.