Wednesday, July 30, 2008

PeopleTools Grid Controls and Subpages

I had the situation today where I needed to change the column header in a grid on a subpage via PeopleCode. I tried adding the following to the PageActivate PeopleCode on the subpage:

GetGrid(Page.PS_Subpage, "GridName").ColumnName.Label = "MyNewColumnName";

I kept receiving an error that the grid could not be found on the page. I thought that was interesting, double-checked my code to verify that I didn't have any typos and tried again. Same error. It then occurred to me that maybe the processor doesn't interpret subpages as a different page object. I changed my code to reference the page that was hosting the subpage...

GetGrid(Page.PS_HostPage, "GridName(from subpage)").ColumnName.Label = "MyNewColumnName";

... and my code started working.

We still have the 8.46 toolset, so this might not be an issue with newer versions of PeopleTools.

Wednesday, July 2, 2008

PeopleTools: How-To rename table names on a page via SQL

I have frequently run into the situation when cloning a page where you want to rename a table on a page, but want to keep all field properties the same (ie, custom label, fieldname, etc.). In PeopleTools, when you change the record name on a field, all of the properties get wiped out, so you end up doing a lot of unnecessary cutting and pasting to reset all of the properties. A better way of doing this is to just update the page record directly via SQL:

update pspnlfield set recname = :newrec where pnlname = :pagename and recname = oldrec;