Monday, August 31, 2020

How to automatically expand the Navigator in the Fluid NavBar

Whilst looking for a solution to do this I came across Sasank's page documenting how he achieved this, via injecting JavaScript and using JQuery. 

The downside, at least for me, was implementing all of the other JavaScript to actually trigger the click event. What I really wanted was a native JavaScript solution, i.e. without any frameworks.

With Fluid pages it is now possible to inject JavaScript (and CSS) through Fluid specific PeopleCode events. There are quite a few different functions, which are documented here.

So we know that we can inject JavaScript into a Fluid component, and we also know that the NavBar is a Fluid component. So, can we use Event Mapping to inject the PeopleCode? The answer is yes we can.

Like any Related Content Framework PeopleCode, you need to:

  • Create an Application Package PeopleCode class.
  • Create a Service Definition with a URL Type of Application Class, and reference the class created above.
  • And then map the PeopleCode to the Content Reference (Event Mapping).

import PT_RCF:ServiceInterface;

class OpenNavigator implements PT_RCF:ServiceInterface;
   method execute();
end-class;


method execute
   /+ Extends/implements PT_RCF:ServiceInterface.execute +/
   AddJavaScript(HTML.OPEN_NAV_MENU);
end-method;

The HTML referenced is as follows:

var callback = function () {
    // Handler when the DOM is fully loaded
    if (document.querySelector("[page='PTNUI_NAVBAR']") !== null) {
        let navButton = document.getElementById('PTNB$PTNUI_NB_MENU');
        navButton.click();
    }
};


document.addEventListener("DOMContentLoaded"callback);

The component you map this your Service Definition to is found here (hidden by default so remember to check the 'Include Hidden CREFs' checkbox):

Root > Fluid Structure Content > Fluid PeopleTools > Fluid PeopleTools Framework > NavBar

Given that this solution does the same thing as Sasank's solution, I did not add any extra screenshots showing the before and after. And whilst there probably are better ways of doing this, this is what I found working for me.

Credit for the JavaScript idea belongs to the post here


    Saturday, June 27, 2020

    Using the CompanyInfo element


    Note that I worked on this in the FSCM Image 35, which is PeopleTools 8.58.02.
    • I think it looks quite promising though, considering this is all just done through configuration.

    You need to have the following two roles:
    1. Secure Branding Administrator: Otherwise you cannot access the Define Headers and Footers page.
    2. Company Info Administrator: Otherwise the CompanyInfo element will not appear in the Tree.














    Navigate to the Define Headers and Footers page and select DEFAULT_HEADER_FLUID:
    Home > PeopleTools > Portal > Branding > Define Headers and Footers

    • From inside of the tree, click on the CompanyInfo element.
    • Click on the Additional Options hyperlink within the Element Properties group box to the right.
    • Check the 'Enable Company Banner Area' checkbox and, optionally, the 'Use Different Content for Classic and Fluid' checkbox.
    • Enter what you like into the Rich Text.

    You can use Meta-HTML in the Rich Text Editor. I noticed there are two HTML objects which contain examples of them being used in HTML (as this is ultimately rendered):
    • PT_INFOPAGECONNECT_FLUID
    • PT_INFOPAGECONNECT
    In my testing it seemed as though several of the Meta-HTML variables did not work in the header for Classic/Classic Plus pages, even though they did work in the 'Info Page' (Ctrl + Shift + J):
    • %Browser
    • %BrowserVersion
    • %BrowserPlatform
    • %Menu
    • %Component
    • %Page
    • %AppServer
    • %CompBufferSize
    I also noticed that in the Classic [Plus] components, the styling of the header looked more like it comes from the 8.57 theme, i.e. that blue look rather than the 8.58 look. I do not know if this is a bug or not, but this could be fixed via modifying the DEFAULT_THEME_FLUID Style Sheet.
    • Just search for .ps_box-headerbranding

    I was able to successfully use the following Meta-HTML variables in both Fluid and Classic:
    • %UserId
    • %DBName
    • %Message(n,n)
    • %ToolsRel
    • %AppsRel
    • %ServicePack
    • %Image
    Two notes on using the Meta-HTML variables:
    1. I used the %Message variable to reference a Message Catalog object which could be used to show the date when the system was refreshed, including the timestamp of the restore point.
      • The Message Catalog value was just hardcoded to prototype the idea.
      • It could be updated as part of a refresh process.
    2. The %Image variable needs to be used with the Source button on the Rich Text Editor, so that you can embed an <img> tag directly.

    Some final thoughts on the process:
    1. As recommended it is probably better to clone the objects rather than customize the DEFAULT_HEADER_FLUID.
    2. Be careful with how much you put into the header is it makes the header/banner grow taller.
    3. My little foray into this probably needs more effort in terms of styling.
    4. I should look into Macro Sets for Branding.
    Some examples:







    Saturday, May 23, 2020

    Cloud Manager Image 10


    Resource Stack: Choosing "PeopleSoft Cloud Manager for OCI" from the Marketplace.

    In the end, this seemed to work reasonably well. Although I think I had some issues with this, and I ended up with three different VCNs with the same name.

    Issues with Self Update
    Issues with installing the second IH (for self update) in a different VCN. See above.
    • I ended up terminating the instances and doing the stack resource update again with a different VCN to avoid confusion.
    The Windows client password wasn't complex enough.
    • I should have really paid more attention.
    The Linux server wouldn't create.
    • After help from Oracle and trial and error (experimenting with creating instances manually) the issue seemed to be the that my account/tenancy didn't have the authority to create the instance using the Linux 7.7 template from the drop down in Cloud Manager.
    • I had to find the 7.8 image from https://docs.cloud.oracle.com/en-us/iaas/images. This failed again due to selecting the Gen 2 image, so had to use the regular image.
    The Windows provisioning failed (although the instance was created) as the 8.57 tools didn't exist on f:/somewhere.
    • I had to subscribe to the Windows 8.57 Linux channel. Then redo the step in Cloud Manager.
    The change package failed (Change Assistant), but you don't get much from the Terraform logs.
    • I had to RDP to the server and look at the Change Package logs. 
    • An App Engine was trying to insert into a table where the unique key already existed.
    • I marked the step as complete and resubmitted the job and it completed.
    • I restarted the steps in Cloud Manager

    To be honest I had to mark several steps as complete, and I don't really think the self-update even worked.
    • I checked some of the update/bug ids from the download pages against the PS_MAINTENANCE_LOG and I couldn't see any of them.

    Final thoughts on the self update
    This was a very painful process. I think there is a lot of work that could be done to make this a more 'polished' process, and less prone to (user) errors. I found the terminology sometimes also confusing.

    I find the Virtual Box based PI a lot easier to install! But this is probably due to more practice.


    Installing FSCM Image #35
    After subscribing to the channel, and creating an Environment Template I was able to create the environment. Once you click done (or start) the process starts.

    This Cloud Manager process actually provisioned the Linux and Windows Server compute instances, but the DPK failed.

    After looking at the logs on the server (the terraform logs were not terribly helpful), it turned out the Oracle database wasn't able to be created due to some missing prerequisites. 
    • Perhaps due to the different Linux build and 8.58 or 19c?!

    Eventually I found MOS doc 2651114.1 which seemed to be a pretty close fit with the issue I had and recommended checking some other logs, which once I did, confirmed the same issue. The solution was to contact your IT department and installing the missing package.
    • E-PUM: When Installing an 8.58 Based PUM the Following Error is Seen: Inventory.xml NOT Found (Doc ID 2651114.1)

    Obviously I can install the package, and probably even start the puppet apply again. But I assume this won't feed back into Cloud Manager.

    So ideally it needs to be done before the automated puppet build starts, i.e. as part of the DPK build. You can't do it earlier, as the creating the environment in Cloud Manager also provisions the Server.

    Luckily, you can configure a script to be run before (and after I think) the DPK builds. This can be configured in the Environment Template or during the Environment build itself.
    • I chose to do it in the template.

    I then had to delete the environment again, which thankfully also terminates the instances in OCI as well.

    After added the environment again, it (eventually) completed. This must have taken around 2 hours.
    But in the end happy to have the new EP92U035 system up and running.

    References
    • For setting up Cloud Manager and provisioning an environment:

    • For the self update:


     

    Thursday, November 21, 2019

    Fluid Attachment Framework

    I recently had a requirement to have a run control page with attachment(s) so that an Application Engine can process the file.

    I decided to implement this as a Fluid page and using the Fluid Attachment Framework, which was implemented as part of Image 25, and there are a couple of write ups on the feature:


    Implementing this was fairly easy, and the only issues I had were:
    1. The subpage which was inserted into the run control page was the first item, and saving the page in Application Designer gave an error "More than one data record in scroll".
      • Once I changed this to not be the first page item, i.e. I moved it down to the bottom in the page order, the error went away.
    2. My page was navigated to by way of another page and the Transfer function, and I originally didn't register it as a portal content reference. This caused one of the queries related to security to not return a value, and give a null exception error.
      • I registered the component and made it hidden.
    3. As referenced in the red paper, there are two component scoped Rowsets which need to be declared and initialized, otherwise errors occur.
      • Ensure that these objects are initialized prior to calling the event.
    4. Originally I had my run control record as level 0 (it had OPRID and RUN_CNTL_ID and the required subrecord). But then when saving the page, the SEQ_NBR on the subrecord is a key and caused a NULL insert error.
      • The solution was to just use PRCSRUNCNTL as the level 0 record, and then the level 1 record is the custom run control record (with the attachment sub record).
    5. The 'Maintain Definitions' page needed to have the 'All values' checkbox selected for the Context Keys. 

    In the end I think this is a nifty feature that allows you to plug in an attachment framework fairly easily.


    Wednesday, May 29, 2019

    Action Menu Items

    The 'View All' notifications page (PTPN_VIEWALL_GRID) has a good example of this.

    It is embedded with a Custom Grid Header group box type. Inside this group box is another one (and in this case labelled Actions via PTPN_WRK.PTPN_GBOX1), and has a group box type of Popup and a style class of 'psc_button-simple'.

    Then there is another group box with a style class of 'ps_menusection', and a group box type of Menu. Then within this is a group box for each link or menu item. This group box has a type of Menu Item and a style class of 'ps_menuitem'. The hyperlink fields within this group box have no special fluid attributes.


    Order Field Type Style Record/Field Label
    First Group Box Custom Grid Header psc_button
    Second Group Box Popup psc_button PTPN_WRK.PTPN_GBOX1 Actions
    Third Group Box Menu ps_menusection
    Fourth Group Box Menu Item ps_menuitem
    Fifth Hyperlink PTPN_WRK.PTPN_READ Mark as Read

    What is also interesting is that in PeopleTools 8.56 the Group Box Types "Menu" and "Menu Item" do not exist. Instead they are using "Layout Only" with the HTML Tag of UL and LI respectively.

    But the effect seems to be the same.

    There is also PeopleCode hiding and displaying by making use of the following:
     If &bAtleastOneSelected Then
        PTPN_WRK.PTPN_GBOX1.FreeFormStyleName = "";
     Else
        PTPN_WRK.PTPN_GBOX1.FreeFormStyleName = "psc_force-hidden";
     End-If;


    Java to get the file separator

    There are several different techniques for getting the file separator, i.e. "/" for Linux and "\" for Windows.

    In the PSXPFUNCLIB.FUNCLIB.FFo there is a function called GetDirSeparator(), which just looks at the first character of the PS_SERVDIR environment variable. On Linux it will be "/", so it will return this, otherwise if it is not "/" it will return "\".

    You can also check the OS environment variable, which on Windows seems to be set to "Windows_NT". So this can be checked and return "\" if it is, otherwise "/".

    • Equally, you could check something like HOME for starting with "/".


    Lastly you can also do something like this:
    class Utilities;
       property string sDirSeparator get;
       
    end-class;
    
    get sDirSeparator
       /+ Returns String +/
       Return GetJavaClass("java.io.File").separator;
    end-get;
    

    Tuesday, May 28, 2019

    Fluid Activity Guide step validation

    Navigation Validation

    The navigation at the top of the page will allow users to click through, which may not be what you want if you want the users to enter mandatory information before moving to the next step.
    The MOS Doc ID 2309032.1 describes how to do it, especially when you are just moving from one page to another within a component.

    Essentially you can add navigation buttons to the pages, e.g. add the fields to a subpage which can be added to each page. There should be one button per page.
    I used fields named PTGP_CUSTBTN_PB_nn and added them to a Group Box (layout only), and added two specific style classes to each field:

    • ps_ag-custom-step-button-
    • psc_hidden
    You can run something like this to get the item id:

    SELECT LOWER(A.PTAI_ITEM_ID),A.PTAI_SEQ
    FROM PS_PTAI_ITEM A
    WHERE 1 = 1
    AND PTAI_LIST_ID = 'FSU_KK_UPD'
    ORDER BY A.PTAI_SEQ
    

    Then in the FieldChange event you add the following to your navigation buttons:
    Declare Function genOpenStepScript PeopleCode FUNCLIB_PTGP.FUNCLIB FieldFormula;
    
    AddOnLoadScript(genOpenStepScript("fsukkudoct1", True));


    So if you are on the first page, and you don't want people to skip to the second page without completing the first page you can add any validation you want before invoking the AddOnLoadScript() function.

    A nice touch is to use a secondary modal page, and add all the messages (e.g. one for each field) to a long edit box. The Payment Request wizard in FSCM is a good example of this.