Peoplesoft is showing much technological advancement along with the fluid technology. Most of these are aimed at improving the user experience and productivity. One such great functionality that benefits the users will be the Push Notification functionality.
We are moving to a new era in Enterprise Applications where notifying the users via emails or work list entries are becoming a norm of the past. The latest trend is to show the notifications or messages directly to the user within the application itself that too at the real time; similar to the notification capability we currently have in many new generation web sites. The PeopleSoft Push Notification functionality helps us achieve the same in PeopleSoft applications.
PeopleSoft push notifications can be broadly categorized into two, the one with actionable items and the one with informational only messages. These messages also have the capability to redirect the user to any other application pages relevant to the message.
PeopleSoft applications are already delivering push notification messages along with the applications such as approvals. However there can be scenario where you need to have your own notification messages. In this post I will be explain how a new push notification message can be developed for your application. Before you start developing it is expected that you are on a tools release >= 8.54 and have push notification configured in the environment (PeopleBooks Link).
Setting up a push notification message won’t take more that 10 lines of code. The key to the new push notification development is the application class PTPN_PUBLISH:PublishToWindow, where there are pre-defined methods to which the developer needs to pass the parameters.
The parameters that you have to pass to the application class objects would be the recipient user list or role list, message to be displayed, URL to which the link needs to point to, whether it is actionable, the action label and messages allowed etc.
I am providing a sample piece of code which will generate a sample notification (shown in the picture below) message instantly.
The following people code is written on the FieldChange event of the push button, so that the notification is sent out whenever the user clicks the push button. You may write the code depending on your business case and pass the appropriate parameters.
As opposed to my previous posts, the steps and explanations are included in the code itself. So make sure you read through the comments provided in between the code lines to see more details on the code.
Local PTPN_PUBLISH:PublishToWindow &objNotification;
Rem Initialize the notification message. Pass the event and category name you might have created. For testing purpose you can use the same code given below;
&objNotification = create PTPN_PUBLISH:PublishToWindow("PUSHNOTIFICATIONWINDOW", "SENDNOTE");
Rem Provide the category name you might have created for your application. For testing purpose you could provide any sample value and test it out;
rem For Actionable notifications use the below method;
rem For alerts use this method. The current example is for alert kind of notifications;
Rem Provide any key identification value to distinguish the message, you could give the transaction key or a timestamp as example;
Rem Pass the actual message that needs to be displayed to the user;
&objNotification.SetMsgInfo("Here is my first message.");
Rem Pass the message state. SetMsgStateNew can be used for new messages. For cahnes in message state, you may use the methods SetMsgStateUnread, SetMsgStateRead and SetMsgStateDismiss. To get the current message state use the method along with the user id GetMsgState();
rem For Actionable kind of notifications use the below method where you pass the actions label and the resulting URL;
rem &objNotification.SetArrayOfActions(CreateArray("View Assignment", "View My Calendar"), CreateArray(&URL1,&URL2));
rem I am generating a URL which will bring the user back to the page where the message has originated;
&sURL = GenerateComponentPortalURL(%Portal, %Node, @("MenuName." | %Menu), %Market, @("Component." | %Component), %Page, "U");
Rem Pass the URL to which the user needs to be re-directed when they click on the message (link);
Rem Pass the operator ID/Role of the recipient to which the notification needs to be sent. Pass 1 for user ID and 2 for role name ;
rem In case of multiple users or roles use the below method;
rem &objNotification.AddRecepients(&arUserList, 1);
rem Finally use the Publish method to publish the notifications to the users;