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.


Fluid Notes

Page Titles

The Activity Guide seems to suppress the page title, and although there are numbered stops at the top of the page, it may not always be the most helpful.

So you can add a Group Box and use the Group Box Type of "Page Title". This will add text like "Step x of y: Page Title".


Custom Grid Headings

If you want to use your own buttons for the grid, e.g. insert row which invokes a modal page or an activity guide, then you can add a Group Box to the page with a Group Box Type of "Custom Grid Header". Then in the Fluid tab on the grid page control you can update the Custom Grid Header to use your page field number for the group box.
  • This seems to be a common technique used by Oracle.
  • It does not seem to require any styles to be applied to the page fields.


Wednesday, May 1, 2019

Database grants

Depending on how you query your tables or views, and with which database user you are doing that querying with, it is possibly that a table alter or a rebuild of the view will strip the object of your Select (and possibly other) permission(s).

An easy way to resolve this is to have a SQLExec() function run which reapplies the missing grants. This also assumes that:
a) It is easier to do this than to contact your DBA team, and
b) You have an easy way to run the SQLExec(), e.g. using an IScript.
c) This is in Development only :)
SQLExec("GRANT SELECT ON MY_OBJECT TO MY_USER_OR_ROLE");