Wednesday, May 25, 2016

Changing the page title in Fluid at run-time

One of our customers asked us to implement nested landing pages, in which some tiles would open a second landing page and eventually a third one and so on. Let me illustrate the use case with some screenshots (I apologise as they are in Spanish, but it should be useful anyway). This would be how the main landing page would look like:


By clicking the "FormaciĆ³n y Desarrollo" tile, a new landing page will be displayed:


And eventually, you can click a tile in this landing page which opens a third one. Let's pick "FormaciĆ³n Acceso al Puesto" for instance:


Unfortunately, the customer could not take advantage of the Master - Detail Framework as they are on PeopleTools 8.54 and this functionality is only available in release 8.55 (which is more complex to upgrade to as Crystal Reports are no longer supported).

So, we decided to build a custom component for our nested landing pages. The component would be called again and again with different URL parameters, in such a way the history could be maintained and the user could go to the previous step instead of going back all the way through the top landing page.

As we were reusing the same component, we needed to adjust the page title in PeopleCode. There involved not only updating the page title itself, but also making sure the back button showed the title of the previous page.


Changing the Navigation Bar Title

By default, the title is set to the component label in the menu. Luckily, there is a good number of examples in the standard functionality on which the title is set at run time, so this one was not particularly difficult to implement. The code that makes the trick is the following:

PTLAYOUT.PAGETITLE_GROUPBOX.Label = &title;

This code needs to be placed in the page activate event. If placed anywhere else, the standard PT_HEADERPAGE Activate code will override the title back to the default one.

Another option is to create a custom header page and add it to the component, but at least from the back button functionality point of view, it did not seem an easy solution.

Changing the Back Button Title

This one was trickier. PeopleSoft maintains a navigation history stack in Javascript which is populated with the default page title at load time using the following Javascript call:

AddToHistory('Cns Navgrppage', '', '', 'CNS_NAVGRPPAGE', 1, 27);

So, in order to keep the right page title in the navigation stack, we needed to update it. Fortunately, there is another Javascript function provided by PeopleSoft called UpdateHistory. The PeopleCode function AddOnLoadScript is particularly helpful when trying to run Javascript functions after the page is loaded. This is the way we implemented the call also in the page activate PeopleCode event:

AddOnLoadScript("UpdateHistory('" | &title | "', undefined, undefined, undefined, 1);");









Monday, April 18, 2016

Installing Update Images in Amazon Web Services

The last PeopleSoft Update Manager (PUM) images have been delivered in two formats: the traditional VirtualBox image and a newly introduced format: NativeOS.



NativeOS takes advantage of PeopleTools 8.55 Deployment Packages (DPK), which is the cornerstone for the PeopleSoft Cloud Architecture. This new cloud architecture facilitates the deployment of PeopleSoft applications in the cloud, not only covering Oracle Public Cloud but also other providers such as Amazon Web Services (AWS), Google Cloud and Microsoft Azure.

Creating the AWS Instance

At BNB we have been using Amazon Web Services for a while, so it was our natural choice for installing the PeopleSoft HCM Update Image #17. We have done so in a Windows 2012 server using the m4.large instance type, which allocates 2 vCPUs and 8 Gb of RAM. In terms of disk, we have allocated 200 Gb in order to have the needed space for the image download and installation.

Once the instance was created, we downloaded the NativeOS update image from My Oracle Support. Once of the good advantages of NativeOS deployments is that the size of the download is less than the traditional VirtualBox one. Still, the size is considerable, but the network throughput in AWS instances is quite good.

Before proceeding with the installation, you need to edit the c:\windows\system32\drivers\etc\hosts file in order to include the internal server name in it:

127.0.0.1 <server name>.<zone>.compute.internal

The full server name can normally be found in the desktop top right corner.

Once this is done, we are ready to proceed with the DPK installation. For further information on this, I suggest you check My Oracle Support.

Allowing External Access

If you would like to access the PeopleSoft Update Image without connecting with remote desktop to the server, you will need to take some additional steps.

Firstly, you will need to edit the security group linked to your AWS instance so you allow incoming TCP connection at the 8000 port, which is the port used by the PeopleSoft Update Image web server by default.

On top of this, you will need to change the firewall setting in the Windows server itself. This is done within the Windows Firewall with Advance Security application, on which you need to define an inbound rule also allowing 8000 port TCP connections:


Finally, if you want to use the same IP address every time you use the AWS instance, you will need to define an Elastic IP and associate it with the server. This fixed IP address has an additional cost, but if you are planning to distribute the URL to access the PeopleSoft application to other people who does not have access to the AWS Console in order to check the current IP address, it may be the only way to go.


Thursday, October 15, 2015

Scaling FLUID pages for iPhone 6

We are currently developing FLUID pages for a customer on PeopleSoft HCM 9.1. As they cannot benefit from the standard functionality delivered through Update Manager until they upgrade to PeopleSoft HCM 9.2, they have decided to provisionally implement FLUID through customisations.

When doing this, we have identified an issue in iPhone 6 by which the FLUID pages were not correctly scaling:



As you see, the text is barely readable. After some research, we have identified that standard pages deal with this scaling issue by using the following PeopleCode (normally in the component PostBuild event):

Declare Function GetDefaultViewportSetting PeopleCode PTLAYOUT.FUNCLIB FieldFormula;
Declare Function SetViewport PeopleCode PTLAYOUT.FUNCLIB FieldFormula;

Local string &Viewport;
Local number &Pos;

&Viewport = GetDefaultViewportSetting();

If %Request.BrowserDeviceFormFactor = 0 And
      %Request.BrowserPlatformClass = "ios" Then
   &Pos = Find("minimal-ui", &Viewport);
   If &Pos = 0 Then
      &Viewport = &Viewport | ", minimal-ui";
   End-If;
End-If;

SetViewport(&Viewport);
AddMetaTag("format-detection", "telephone=no");

The page now displays in a much better format:




Friday, August 21, 2015

Formatting Rich Text Comments in BI Publisher

In the last years, BI Publisher has become the go to tool to cover most reporting needs in PeopleSoft, replacing other technologies such as Crystal Reports and SQR in many scenarios.



The basic concept behind many reporting tools is separating data and presentation logic, so report designers can work in parallel with developers who know the data model in detail. BI Publisher is the PeopleSoft reporting tool that achieves this separation in a more thorough way. It does so by using XML as the information exchange format between the data generation and the report generator. Practically all systems have a way to export data in XML nowadays, and PeopleSoft is not the exception, with options ranging from Connected Queries, File Layouts to PeopleCode managed XMLDocs. From my point of view, this is major advantage over other technologies like Crystal Reports, which in its PeopleSoft version could only extract data from PeopleSoft queries (if you needed to extract somehow complex information, you would need to create an extraction program).

Other advantages of BI Publisher are the bursting capabilities (separating report output based on certain data fields) and the possibility to generate online reports without using Process Scheduler.

Formatting Rich Text Fields

I have to admit that I'm far from being a reporting expert, but in one of my latest projects I came accross the need to develop several of them. One of these reports needed to display comments previously entered by users in rich text format. BI Publisher provides a function to do so:
<?html2fo:elementname?>
However, this function has a problem I was not able to solve (I admit there could be other solutions but I could not find anything as part of my research in a few forums): if you are building a report with certain style guidelines, the rich text would always be rendered using Arial 12pt as the base font. This resulted in a very funny looking report, with large fonts coexisting with smaller ones. Of course, there was the option to also use Arial 12pt as the report base font, but users are not always ready to change their aesthetic requirements.

In the end, we found out that the html2fo function would render the rich text using the inline style of HTML elements. PeopleSoft normally does not set a font-family nor font-weight (please check the note at the end of the document), so BI Publisher automatically applies the default style, which is Arial 12pt. However if you set the style be yourself, BI Publisher would accept it.

The following code shows an extract of how we set this style:

Function FormatRichTextForBIP(&text As string, &fontSize As string) Returns string;
   Local string &result;
   
   If All(&fontSize) Then
      &result = "<div style='font-family: verdana;font-size: " | &fontSize | ";'>" | &text | "</div>";
   Else
      &result = "<div style='font-family: verdana;'>" | &text | "</div>";
   End-If;
   
   Return &result;
End-Function;


(...)
&reportingRec.COMMENTS.Value = FormatRichTextField(&inputRec.COMMENTS.Value, "12pt");
(...)

Note: This approach would not work if within the rich text the user has included different font sizes. This basic approach works when no font-family or font-weights are applied within the stored rich text HTML. In any case, this is a solvable issue, although it may require some more work. What you need to do is parse the rich text and replace the desired style clauses.

Tuesday, June 23, 2015

Creating Custom Listening Connectors using Integration Broker SDK

One of my customers recently had the need of allowing a third party web application to attach files into PeopleSoft. After trying a number of different approaches (the integration had to be done at the web application client level, which significantly reduces the options to manipulate the request to PeopleSoft before sending it, particularly when dealing with old web browsers), I gave up and came to the conclusion that I needed a custom listening connector in Integration Broker to implement such integration. 



The process of developing and installing a custom listening connector in Integration Broker is quite well described in PeopleBooks, however, I thought it would helpful to document the process I have followed.

Samples


PeopleSoft comes with some samples of connectors developed using the Integration Broker SDK. The most interesting one for listening connectors is ExampleServletListeningConnector.java located in the following folder:

$PIA_HOME/webserv/IFHRDEV/applications/peoplesoft/PSIGW.war/WEB-INF/SDK/src/samplelisteningconnectors.java

I've used this sample as the basis for my custom connector. In some cases, I also found quite handy to decompile the standard connectors such HttpListeningConnector. I could not find any exhaustive source of documentation of the Integration Broker SDK, so decompiling the existing connectors proved to be a good way to understand how to best use the SDK.

Note: For decompiling the Java class files I have used a very simple tool names cavaj. It is a very simple tool, but still helpful.

Development

Taking the previously mentioned sample as the basis, I have coded my own connector. If you are not interested in the details, you may want to skip to the next section.

What I needed to do in my connector was basically two things:

  1. Encode the incoming file using Base64, as binary files could not be processed otherwise by the existing PeopleCode Message API.
  2. Pass any parameters received in the HTTP Header or the URL as part of the IBInfo (Integration Broker information included in every internal Integration Broker message.


If you want to check the actual code, you can download the source code from this link:



Compiling

Once your source code is ready, you need to compile it. The first step for Java compilation is to set the environment variables so they point to the Java SDK. In my case, I was using the PeopleSoft HCM 9.2 Update Image 11, and these were the commands I needed to use:

export JAVA_HOME=/opt/oracle/psft/pt/jdk1.7.0_71
export PATH=$PATH:$JAVA_HOME/bin

Then I went to the directory were my java file was placed and run the following command to compile the file:

javac -cp /home/psadm2/psft/pt/8.54/webserv/peoplesoft/applications/peoplesoft/PSIGW.war/WEB-INF/classes:/home/psadm2/psft/pt/8.54/webserv/peoplesoft/applications/peoplesoft/PSIGW.war/WEB-INF/lib/mail.jar:/opt/oracle/psft/pt/bea/wlserver/server/lib/weblogic.jar FileUploadListeningConnector.java 

The paths may obviously differ in your case, but the important thing is to include the following directories/jar files in your class path:

  • $PIA_HOME/webserv/peoplesoft/applications/peoplesoft/PSIGW.war/WEB-INF/classes
  • mail.jar
  • weblogic.jar

Please note that weblogic.jar was needed because I was using WebLogic as my web server. In case you use WebSphere, you need to change this jar file.

Deployment

Once the file is compiled, you need to copy the resulting class file to the following directory:

$PIA_HOME/webserv/IFHRDEV/applications/peoplesoft/PSIGW.war/WEB-INF/classes/com/peoplesoft/pt/integrationgateway/listeningconnector

The next step is to let WebLogic know that there is a new servlet available. This can be done by editing the following file:

$PIA_HOME/webserv/IFHRDEV/applications/peoplesoft/PSIGW.war/WEB-INF/web.xml

All you need to do is to duplicate the sections referring to ExampleServletListeningConnector and replace those appearances with your connector name. In my case, I was using PeopleTools 8.54, and these were the lines I had to include:

(...)
<servlet>
<servlet-name>ExampleServletListeningConnector</servlet-name>
<servlet-class>com.peoplesoft.pt.integrationgateway.listeningconnector.ExampleServletListeningConnector</servlet-class>
</servlet>
<servlet>
<servlet-name>FileUploadListeningConnector</servlet-name>
<servlet-class>com.peoplesoft.pt.integrationgateway.listeningconnector.FileUploadListeningConnector</servlet-class>
</servlet>
(...)
<servlet-mapping>
<servlet-name>ExampleServletListeningConnector</servlet-name>
<url-pattern>/ExampleServletListeningConnector/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileUploadListeningConnector</servlet-name>
<url-pattern>/FileUploadListeningConnector/*</url-pattern>
</servlet-mapping>
(...)

Testing

In order to test the new connector, you need to reboot the web server so the changes made to register the new servlet are taken. Once this is done, you can check if the new listening connector is responding by using the declared URL:

http://webserver/PSIGW/FileUploadListeningConnector


Monday, March 30, 2015

A command-line alternative to PeopleSoft SendMaster

If you are familiar with PeopleSoft Integration Broker, I'm sure you have dealt with SendMaster to some degree. This is a very simple but yet useful tool to perform unit tests of the Integration Broker incoming service operations using plain XML (if I'm dealing with SOAP Web Services, I normally use SoapUI, for which there is a very good article on PeopleSoft Wiki).

Most of the time it's enough with SendMaster, but today I came through a problem that required an alternative. While testing an XML message with this tool against an HTTPS PeopleSoft installation, I got the following error message:

Error communicating with server: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

After checking in My Oracle Support, I've found the following resolution (doc 1634045.1):

The following steps will resolve the error:

1) Import the appropriate SSL certificate to the java kestore PS_HOME\jre\lib\security\cacerts or Integration Broker's keystore location i.e pskey file
2) Set sendmaster's preferences  ( via File-Preferences-HTTP tab )  to point to the keystore with the appropriate SSL certificate
3) Test

Unfortunately, I didn't have access to the appropriate SSL certificate, so I've decided to use curl, a pretty old (dating back to 1997 according to all knowing wikipedia) but still useful command line tool.



curl is a command line tool that can be used to test HTTP and HTTPS operations, including GET, PUT, POST and so on. One of the features of this tool is that it can run in "insecure" mode, eliminating the need of a client certificate to test URLs on HTTPS. Both in Linux and Mac OS, the option to run in insecure mode is -k. The command line to test my service operation then looked like:

curl -X POST -d @test.xml -k https://<server>/PSIGW/HttpListeningConnector 

Please note that the @ option actually requests curl to take the data from the file following it. Instead of doing so, you can specify the data in the command line, but it is a bit more cumbersome.

Also, keep in mind that curl is not delivered with Windows out of the box, but you can download similar tools from several sources (for instance, this one).







Monday, March 23, 2015

Manually applying Global Payroll Rules Packages downloaded from an Update Image

Last week we've faced an issue while applying a Tax Update in one of our PeopleSoft HCM 9.2 customers. The Tax Update was delivered as a PeopleSoft Release Patchset, that needs to be first applied to the Update Image before creating the Change Package using PeopleSoft Update Manager.

Unfortunately, during the process, one rules package delivered in the Tax Update was not included within the Change Assistant steps, and therefore it was missed. Some days after, we reported the error to Oracle and they pointed out to the original zip file containing the PeopleSoft Release Patchset, which indeed contained the missing package.

We did not want to repeat the entire Change Package definition steps, as it would have required to restore a couple of backups. Instead, we decided to manually apply the rules package.

Not so fast...

Unfortunately, within Update Manager the Rules Packages are not delivered in the usual format used to import, compare and copy them. Instead, specific steps are followed when Update Manager is used.

In the end, we managed to find a way to manually import the package, which is documented below.

Importing the Rules Package

The rules packages in Update Manager are delivered using the Data Migration Workbench. The process to import them starts by defining the directories from which the Data Migration projects should be picked:

PeopleTools > Lifecycle Tools > Migrate Data > Manage File Locations

The path should point to the PTADSAEPRCS directory within the patch (whose zip file needs to be extracted before). Once the path is defined, the Data Migration project can be copied using the Data Migration Workbench:

PeopleTools > Lifecycle Tools > Migrate Data > Data Migration Workbench

The project should now be uploaded using the Load Project From File link. A list of the projects found the previously defined path will be shown:



Once the project is selected and the Load button pressed, the Project Definition page within the Workbench will be shown:


Applying the Data Migration project is quite simple. In first place, the project needs to be compared using the Compare button and once the comparison has finished, the project has to be submitted for copy (using the Submit for Copy button). 

Note: Data Migration project submissions may need approval. In such case, make sure the request is approved, so the project is actually copied.

The best way to validate whether the project has been correctly copied or not is to check the contents of the PS_GP_PKG_ADS_DFN table, which should now contain the imported rules package.

Rules Package Merge

Once the rules package has been imported, it needs to be merged. The merge process actually takes all the imported rules package and builds a single rule package to simplify its application. Unfortunately, the process is not available from the user interface, but it can still be run using the command line:

<PS_HOME>\psae.exe -CT <database type> -CD <database name> -CO <PeopleSoft user> -CP <PS user password> -R ESP -AI GP_PKG_ADSMR -I 0 -OT 2 -OF 13 -OP <output directory> -CI <connect id> -CW <connect password>

Once the rules package is merged, an usual Rules Package will be accessible within the Global Payroll Packages functionality. From there on, the package can be applied using the steps we were used to.