Send User to a Portal Folder

Your rating: None Average: 5 (3 votes)

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;

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!

Comments

Have a question? Please ask it on the forum instead.
Ashar's picture
User offline. Last seen 1 year 25 weeks ago. Offline
Joined: 03/26/2008
Posts: 227
Re: Send User to a Portal Folder

Really a good post Compshack. Really appreciate you for this.

Thanks,

Ashar

Self Service User's picture
Self Service User (not verified)
Re: Send User to a Portal Folder

I am using the above code. It is working with one problem. It is not showing the top frame.

I want to send the user to a particular folder after the sign-in.
It is not to a particular page but rather to a folder.

I am using the %Response.RedirectURL(&LINKURL) to send the user to the folder after signon. The user is being directed to the particular folder but the top frame ( the one that has the PeopleSoft logo, the Home link and the signout link) is not being displayed.
I used "PSP" instead of "PSC" in the function call for
NavPageURL(%Portal, %Node, "CO_EMPLOYEE_SELF_SERVICE", "PSC", "", "", "False", "", "", "")
but still it did not work.

Any ideas as to how to keep the top frame while using this function.

Thanks

Lepa's picture
User offline. Last seen 2 weeks 1 day ago. Offline
Joined: 06/23/2008
Posts: 590
Re: Send User to a Portal Folder

Yes you are correct, I have noticed that it only works if you are going from a page back to a folder and not from any other place. My requirement was to send the user from a link on a page back to a folder and the above code does just that. There might be another function to do what you are looking for, but unfortunately I'm not aware of one.

On the other hand, I think you can accomplish your result by coding your &URL as such:

&URL = %Request.Scheme | "://" | %Request.ServerName | "/psp/" | Lower(%DbName) | "/" | %Portal | "/" | %Node | "/HRMS/s/WEBLIB_PTPP_SC.HOMEPAGE.FieldFormula.IScript_AppHP?pt_fname=CO_EMPLOYEE_SELF_SERVICE&FolderPath=PORTAL_ROOT_OBJECT.CO_EMPLOYEE_SELF_SERVICE&IsFolder=true";

Is this your best option? Well, probably not, but this is what I've just thought of. Please do share with us your approach when you figure this out. Thanks!

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

Post new comment

CAPTCHA
The question below is to prevent automated spam submissions.
2 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.