Passing Values from One Component to Another Component via PeopleCode

I’ve had a very interesting problem. When I click on a link on Page 1 in Component A, it should take me to Page 2 in Component B after providing values in the Search page, and enter values on Level 0 of Page 2 and simulate pressing of a Push Button on the same page.

Okay, here goes. 🙂

On Page 1’s hyperlink’s FieldChange, write the following code (illustrative purposes only – replace with your menu and other object names)


Local Record &rec;

&rec = CreateRecord(Record.PERS_SRCH_GBL); /* Search record of the target component */

&rec.EMPLID.Value = "KU0002"; /* assign value to search key field (this example assumes EMPLID is the only search key on the target component) */

&URLString = GenerateComponentPortalURL(%Portal, %Node, MenuName."MANAGE_PAYROLL_PROCESS_(GBL)", %Market, Component."GP_SS_PSLP_ADMINVW", Page."GP_SS_PSLP_ADMINVW", "U", &rec);

&content1 = "&FROM_DATE=06/29/2014&TO_DATE=09/29/2014";
ViewURL(&URLString | &content1, True);

In the above code, PERS_SRCH_GBL is the Search record of GP_SS_PSLP_ADMINVW, which has EMPLID as key. But, once I get into the page(GP_SS_PSLP_ADMINVW), whatever value I have from Page 1 should be populated on the FROM_DATE and TO_DATE fields on the GP_SS_PSLP_ADMINVW page. Now, if you have additional fields on your page that should have values populated, you can always modify variable &content1’s text.

Make sure you remember to put an ampersand (&) after each parameter.

&content1 = "&FROM_DATE=06/29/2014&TO_DATE=09/29/2014"; 

Now that the first part is done, lets proceed to the next step.

Open GP_SS_PSLP_ADMINVW.PageActivate PeopleCode

Local string &from_date = %Request.GetParameter("FROM_DATE");
Local string &to_date = %Request.GetParameter("TO_DATE");
Local string &emplid = %Request.GetParameter("EMPLID");

If All(&from_date) Then

DERIVED_PSLP_GP.FROM_DATE.Value = &from_date;

End-If;

This PeopleCode gets the values that we had passed to the URL and uses it in the Page. And to simulate the Push Button, all I had to do was to look for the code that gets triggered when clicking on the Page button. And that fortunately happened to be a single function. 🙂

All I had to do was to call the function within the above if-loop.

And, voilà! I couldn’t find better alternatives. If you find one, please add them in the comments section. I’ll have the posted updated with your code, with due credit of course. 🙂

Until then, have fun!! 🙂

Advertisements

About Manikandan Surendren

A PeopleSoft Techno-functional Consultant. An engineering graduate in Computer Science. Technology Enthusiast. Movie freak. Gadget geek.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s