Pass Dynamic Value to a Grid Label

Your rating: None Average: 2 (1 vote)

A grid label is the blue (normally) colored grid header that you see on PeopleSoft pages. The grid text label can be easily edited using the Grid Properties in app designer. Once you have the grid properties box open, click the Label tab > Properties and there you can see the Label Text area. You can choose between a Static Text type or Message Catalog. I would almost always go with Message Catalog type as this could be easily updated online.

Now, what if you would like to have a part of the grid label text to be dynamic. For example, you want the grid on the Self Service Phone Numbers page to say "Phone Numbers for some user" instead of just "Phone Numbers".

Step one:
Create your message catalog. Mine is (25000, 5) and at the subject line I entered "Phone Number for %1". The %1 will be later substituted with the user name accessing his/her self service.

Step two:
Open the phone numbers self service page in app designer and double click on the grid > Label tab > click 1st properties button (Header Area - Display title) > Type = Message Catalog > enter your Message Set/Number.

Step three:
Add the following code to your page activate event.

Declare Function get_person_name PeopleCode FUNCLIB_NAME.PERSON_NAME FieldFormula;
/* this line might already be there but this is needed if you are working on a custom page*/
&GRID = GetGrid(Panel.HR_PERSONAL_PHONE, "PERSONAL_PHONE");
/* This function converts the name to a user friendly format */
&Name = get_person_name(%UserId, "", "", "");
&GRID.Label = MsgGetText(25000, 5, "Message Not Found", &Name);

There you have it, save and navigate to the page and you should see the user's name showing in the grid label text.

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!