Wednesday, September 23, 2009

Send User to a Portal Folder


Sometimes you would want to give users the option to click a button on the page and send them back to the Portal Folder they came from, or may be couple folders back! Here is how you go about doing that.

You can actually use the PeopleSoft delivered function NavPageURL to accomplish this! So, lets get started!

On your page, go ahead and add a button. Place the following PeopleCode at the Component Record Field level under FieldChange event.

Declare Function NavPageURL PeopleCode EOPP_SCRTN_WRK.FUNCLIB FieldFormula;

&LINKURL = NavPageURL(%Portal, %Node, "your-folder-object-name", "PSC", "", "", "False", "", "", "");
%Response.RedirectURL(&LINKURL);

And here is the code for the NavPageURL function:

/********************************************************************/
/* Function:  NavPageURL                                            */
/* Purpose:   Returns the Absolute URL value to the Navigation Page */
/*            for a given collecton object name or folder object.   */
/* Inputs:    Nav Page PortalName, Nav Page NodeName, Nav Page      */
/*            Collection or Folder ObjectName, and URLType.         */
/* Output:    URL value as a string                                 */
/* Format:    &MYURL = NavPageURL("EMPLOYEE", "ERP", "MY_OBJECT",   */
/*            "", "", "", "", "")                                   */
/********************************************************************/
Function NavPageURL
(&PortalName As string, &NodeName As string, &ObjName As string, &URLType As string, &FolderName As string, &TargPortalName As string, &SecValue As string, &VirtualValue As string, &PTfname As string, &PTcname As string) Returns string;
   Local string
&URL;
   
   
If All(&PortalName, &NodeName, &ObjName) Then
     
      Evaluate Upper
(&URLType)
      When
=
"PSC"
         
&URL = GenerateScriptContentURL(&PortalName, &NodeName, Record.WEBLIB_EOPP_SC, Field.HOMEPAGE, "FieldFormula", "IScript_AppHP");
         
Break;
      When
=
"PSP"
         
&URL = GenerateScriptPortalURL(&PortalName, &NodeName, Record.WEBLIB_EOPP_SC, Field.HOMEPAGE, "FieldFormula", "IScript_AppHP");
         
Break;
      When
-Other
         
&URL = GenerateScriptContentURL(&PortalName, &NodeName, Record.WEBLIB_EOPP_SC, Field.HOMEPAGE, "FieldFormula", "IScript_AppHP");
         
      End
-Evaluate;
     
     
&URL =
&URL |
"?scname="
|
&ObjName;
     
     
If All(&SecValue) Then
         
&URL =
&URL |
"&secondary="
|
&SecValue;
      End
-If;
     
     
If All(&FolderName) Then
         
&URL =
&URL |
"&fname="
|
&FolderName;
      End
-If;
     
     
If All(&PTcname) Then
         
/* pass either CFAN Cref or DFAN Fref, not both */
         
&URL =
&URL |
"&PORTALPARAM_PTCNAV="
|
&PTcname;
     
Else
         
If All(&PTfname) Then
           
&URL =
&URL |
"&pt_fname="
|
&PTfname;
         End
-If;
      End
-If;
     
     
If All(&TargPortalName) Then
         
&URL =
&URL |
"&targetportal="
|
&TargPortalName;
      End
-If;
     
     
If Upper(&VirtualValue)
=
"TRUE" Then
         
&URL =
&URL |
"&isvirtual="
|
&VirtualValue;
      End
-If;
     
   End
-If;
   
   
Return
&URL;
End
-Function;

CTY:Compshack

0 comments:

Post a Comment

Total Pageviews

Copyright © Tech & Management Notes