Open New Window PeopleCode

Sometimes you need to open a new window to a PeopleSoft page and when that windows opens you lose the state of your previous page. Here is a function that uses the PeopleSoft newwin servlet processing to open a new window in a new state block.

 This function modifies a URL to return a new window URL 
 It allows a new state block to be generated in a separate browser instance.
 turns into 
 which renders to the browser as 
 Input parameters:  &strUrl - a URL to manipulate
 Output parameters: &strUrlModified - New URL with _newwin parameter
Function NewWinUrl(&strUrl As string) Returns string;
   Local string &sRegex, &sReplace, &Result;
   /* Declare java object */
   Local JavaObject &jUrl;
    * Peoplesoft Content types:
    * -------------------------
    * Component: c
    * Script: s
    * External: e
    * Homepage: h
    * Template: t
    * Query: q
    * Worklist: w
    * Navigation: n
    * File: f
   /* Regex strings */
   /*          psc/psp  Site      Portal    Node      Content Type */
   &sRegex = "/(ps[cp])/([^\/]*)?/([^\/]*)?/([^\/]*)?/([csehtqwnf]{1})/";
   &sReplace = "/$1/$2_newwin/$3/$4/$5/";
   /* Instantiate objects and replace */
   &jUrl = CreateJavaObject("java.lang.String", &strUrl);
   &Result = &jUrl.replaceAll(&sRegex, &sReplace);
   /* Return modified URL */
   Return &Result;
No Comments
Back to top