Tuesday, November 19, 2024

Generating Activity Guide URLs

Creating Activity Guide navigation is challenging for two reasons:

  1. Simple Fluid Activity Guides all use the same component. This means we can't use a simple content reference. To use security to show or hide an Activity Guide content reference, we must use the URL type of PeopleSoft Generic URL. We must type a PeopleSoft URL fragment rather than leverage the traditional Content Reference fields (menu, component, market).
  2. Activity Guides with Runtime Context require dynamically generated URLs. These Activity Guides cannot leverage simple content references.

My PeopleCode for launching Activity Guides with Runtime Context usually starts with a GenerateComponentPortalURL to generate the base Activity Guide framework URL and then a bit of URL concatenation to assemble the Runtime context attributes. Here is an App Class I put together to make this easier.



Here is how you would use it:

import JSM_URL_UTIL:ActivityGuideURL;   
   
Local JSM_URL_UTIL:ActivityGuideURL &urlBuilder = create JSM_URL_UTIL:ActivityGuideURL("JSM_AWE_AG");
Local string &url;

&urlBuilder.addContextItem(Field.EOAWPRCS_ID, "FacilityAccessRequest");
&urlBuilder.addContextItem(Field.DESCR, "Facility Access Request");

&url = &urlBuilder.generateFluidURL();

The addContextItem method takes a key/value pair, both of which are strings (they will become part of the URL string). Since context IDs (keys) are fields, then using Field.FIELDNAME syntax is preferred so Edit | Find Definition References will locate your field usage.

We added one more convenience method: generateGenericPeopleSoftFluidURL(). Use this method to help you craft a PeopleSoft Generic URL to a static Activity Guide. This is a one-time-use method you would call at design time to create that static URL fragment required by a Content Reference. If you have a simple, static Activity Guide with no context, then you may want to create a Content Reference. However, typing all of the parameters correctly can be a challenge. Use this helper method to generate the full Generic PeopleSoft URL for you. We invoke this method from a design-time App Engine, but you may want to create a page for it instead.

Are you interested in learning more about PeopleCode Application Classes? Check out our two-day course available live virtual or on-demand!

4 comments:

Craig Larsen said...

Hey Jim, nice write up. I am building a new AG category to create a simple Activity Guide for exposing an acknowledgement. I am use the base AGC_PROCESS_AG root package. I want to just create a standard content reference (or emailed URL) for this, but need to pass EMPLID or OPRID as one of the context IDs. My issue is that I'd prefer not to use custom launch code. In peoplebooks I found this mentioned:

Note: Any required context parameters defined as system variables are supplied automatically and do not have to be passed as query string parameters.

I can't seem to find how this is implemented. If I don't supply one of the context IDs (like OPRID), I get a SQL error when the AG loads. Any thoughts?

Thanks for all your great content. Been reading for many many years.

Jim Marion said...

Great question! When you configure the context parameters, you can specify the Context Data "Type" as "System Variable." That will populate the context for you. The "Runtime" type must be passed in the URL.

Craig Larsen said...

Ahh, I see that the Context Data "Type" has to be defined in the legacy (PeopleTools) activity guide setup. Strange they did not include that in the Category setup under Enterprise Components. When you say the runtime type needs to be passed, I assume you mean &CONTEXTIDPARAMS=OPRID:%UserId or something similar?

Jim Marion said...

Activity Guide Composer under Enterprise Components is very different. It is really for manipulating Oracle-delivered Activity Guides in an upgrade "safer" manner. I find the "Legacy" approach to be significantly simpler for creating my own Activity Guides. Check out this video for an overview of the differences: https://youtu.be/6vFWrp5ye2E?si=Uh7taMCiVNBpB9KZ

System variables do not have to be passed along the URL if they are defined as system variables. If they are defined as Runtime, then they need to be resolved before creating the URL and then placed into the URL as &CONTEXTIDPARAMS=OPRID:RCHANNING