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 |
Specify the recipient type as a numeric value or a constant value:
|
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, "[email protected]");
&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 |
Specify the recipient type as a numeric value or a constant value:
|
value |
Specifies the values for the recipient type as an array. Specify a number in E164 format for external phone number. |
Returns
None.
Syntax
AddTextAttachment(URLIdentifier, FileName, IsUserSpecific)
Description
Use this method to add an attachment to a text message, but the attachment should be limited to one. If the attachment count is not limited to one, the URL to access the attachments will be long and may be split into multiple messages thereby making it difficult to access the file. The method creates a URL to access the attachment. The URL is iScript based, and you should ensure that necessary permissions are granted to the users to access the iScript library. If the access is not granted, users will not be able to download the attachment.
When a user clicks the URL that they receive, the user is authenticated. If the authentication is successful, a verification process checks whether the URL is created for the logged in user. On successful verification, the attachment is streamed to the user. The attachment is first copied from the repository to a temporary store and then streamed to the user. On completing the streaming process, the file is cleared from the temporary store.
This method does not evaluate whether the attachment exists in the specified URL. Whether the file exists in the specified URL is validated when a user accesses the file.
Parameters
Parameter |
Description |
---|---|
URLIdentifier |
Specify a URL Identifier. |
FileName |
Specify the name of the file that you want to attach, as a string. You must include the file extension as well. FileName can include %UserId% as a template variable, which at runtime is replaced with the actual user ID of the recipient. |
IsUserSpecific |
This parameter, as a Boolean value, controls how the URL is generated.
|
Returns
A Boolean value, True if an attachment is added to the text message; False otherwise.
Example
&bRetCode = &objBroadcast.AddTextAttachment(@("URL.URLIDENTIFIER"), "%UserId%_attachment.pdf", true );
Syntax
AddTextMedia(FilePath)
Description
Twilio supports adding media to text message through it's media URL. Use this method to specify the path of the file and add it to the Twilio media URL. You should ensure that the URL is a direct link to the file. Ensure that the file or media is supported by the Twilio MIME types and that you provide valid HTTP or HTTPS URLs conforming to Twilio standards. For information on supported MIME types and valid URLs, refer to the Twilio documentation (www.twilio.com).
Parameters
Parameter |
Description |
---|---|
FilePath |
Specify the path to the file. |
Returns
None.
Example
&objBroadcast.AddTextMedia("https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf");
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
EnableTracking()
Description
Use this method to track the delivery status (of In-app, email, and text notifications) for each user, however tracking the delivery status may impact performance.
You should invoke the EnableTracking method before calling the Send method. By default, status tracking is not enabled, so you should enable tracking explicitly.
The tracking status can be fetched by calling the GetNotificationStatus or GetUserNotificationStatus method after the notification is sent successfully. The status does not imply that the user received the message. The status only indicates whether the message is successfully sent out of the PeopleSoft system or not. You can check the actual status on corresponding servers, for example, Twilio message monitor for text notifications.
Parameters
None.
Returns
None.
Example
&objBroadcast.EnableTracking();
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
GetNotificationStatus()
Description
Use the GetNotificationStatus method to retrieve the notification channels that are enabled for a list of recipients. You should invoke this method after calling the Send method.
Parameters
None.
Returns
A two-dimensional array containing the user ID of the recipient and a string representing the enabled channels in the order of In-app, mail, and text.
The following table describes the character representation of the return string.
In-app |
|
Text |
Return String |
---|---|---|---|
Not enabled |
Not enabled |
Not enabled |
NNN |
Not enabled |
Not enabled |
Enabled |
NNY |
Not enabled |
Enabled |
Not enabled |
NYN |
Not enabled |
Enabled |
Enabled |
NYY |
Enabled |
Not enabled |
Not enabled |
YNN |
Enabled |
Not enabled |
Enabled |
YNY |
Enabled |
Enabled |
Not enabled |
YYN |
Enabled |
Enabled |
Enabled |
YYY |
Example
&arStatus = &objBroadcast.GetNotificationStatus();
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
GetUserNotificationStatus(oprid)
Description
Use the GetUserNotificationStatus method to retrieve the notification channels that are enabled for a specified recipient. You should invoke this method after calling the Send method.
Parameters
Parameter |
Description |
---|---|
oprid |
Specifies the user ID of the recipient as a String. |
Returns
A string representing the enabled channels in the order of In-app, mail, and text.
The following table describes the channels enabled for a recipient and the returned String value.
In-app |
|
Text |
Return String |
---|---|---|---|
Not enabled |
Not enabled |
Not enabled |
NNN |
Not enabled |
Not enabled |
Enabled |
NNY |
Not enabled |
Enabled |
Not enabled |
NYN |
Not enabled |
Enabled |
Enabled |
NYY |
Enabled |
Not enabled |
Not enabled |
YNN |
Enabled |
Not enabled |
Enabled |
YNY |
Enabled |
Enabled |
Not enabled |
YYN |
Enabled |
Enabled |
Enabled |
YYY |
Example
&status = &objBroadcast.GetUserNotificationStatus( "USERID");
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, "[email protected]");
&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:
Use the Workable category to place a notification, with a Mark Complete button, under Actions in the Notification panel. The Mark Complete button enables a user to dismiss the item from the list directly. |
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.