The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Saturday, 3 August 2013

Navigational functions in PeopleSoft


To transfer from one page to another page or component programmatically, PeopleSoft has provided many built-in functions. I have seen people getting confused on which function to use for their use case, as most of the functions provide same transfer functionality. Each function has its own use case and scenarios to be used with. The purpose of this article is to make a general awareness on the usage of these built in functions for the real scenarios. Most of the readers must be already familiar with the built-in functions mentioned in this blog, so I am not going to explain each functions in detail. For more details on any of these functions, it is advised that you refer People Books.

Let’s take a look at the navigational functions provided by PeopleSoft.

1.       ViewContentURL
2.       ViewURL
3.       %Response.Redirect
4.       DoModal
5.       DoModalComponent
6.       DoModalX
7.       DoModalXComponent
8.       Transfer
9.       TransferExact
10.   TransferModeless
11.   TransferNode
12.   TransferPage
13.   TransferPortal


Opening External Sites

To open external sites or links from within the PeopleSoft application, you can make use of the functions ViewContentURL, ViewURL and %Response.Redirect method.

 If you use ViewContentURL, then your content will not be warped in the PeopleSoft portal. If you want it to be wrapped, then you may use ViewURL function. The first functions will open the url in a new window.
If you are working with iScripts and want to open another iScript page, then you may use the %Response class method.

ViewContentURL(URL_str | URL.URL_ID);
ViewURL(URL_str | URL.URL_ID [, NewWindow]);
%Response.Redirect(URL_Str);

Passing parameters to the component

If your component is designed to accept parameter values, then you can use the functions ViewContentURL and ViewURL functions to call those components with the parameter values. All you need to do is generate the url to the target component using any of the built in functions such as GenerateComponentContentURL() and append that URL with your parameter values. Now you directly use these appended URL with any of the functions mentioned earlier depending on whether you require portal content or not.


Opening another page/component without losing control from current component

Most of the time you may need to bring up data from another page or component to the current context and without losing the current context level. Suppose you are at a page entering some details about an employee. Now you want to bring up the employee address when user clicks on the hyperlink but does not want to navigate away from the main component, so that when they see/confirm the address they can continue the work with the previous component. To provide these features, PeopleSoft has provided the modal functions. Use the DoModal() and DoModalX() functions to bring up a secondary page modally, these will be useful in displaying additional data, warning pages etc. The DoModalX provides you the flexibility of completely replacing the current component with the target page and once you are done, you will be taken back to the original component.

Use the functions DoModalComponent and DoModalComponentX to bring up an entirely new component modally over the current context.  The DoModalComponentX provides the option for the target component to be displayed as replacement or as a layer over the top.

Another option provided by PeopleSoft is TransferModeless function. Use this function if you want to open a component in a modal window over the current window and yet you want to work on both the components at the same time.

The syntax of the functions mentioned is as below.

TransferModeless
        (MENUNAME.menuname,
        BARNAME.barname,  
        ITEMNAME.menu_itemname,
        PAGE.component_item_name,      
        action [, keylist] [, AutoSearch]);

DoModal(PAGE.pagename, title, xpos, ypos, [level, scrollpath, target_row]);

DoModalComponent
(MENUNAME.menuname,
BARNAME.barname,
ITEMNAME.menuitem_name,
PAGE.component_item_name,
action, RECORD.shared_record_name [, keylist]);

DoModalX(showInModal, cancelButtonName, PAGE.pagename, title, xpos, ypos, [level, scrollpath, target_row]);

DoModalXComponent(showInModal, cancelButtonName,
MENUNAME.menuname,
BARNAME.barname,
ITEMNAME.menuitem_name,
PAGE.component_item_name,
action, RECORD.shared_record_name [, keylist]);






Opening another page/component by exiting from current component/page

This one is also a general scenario where you want to navigate away from current component to a new component. Most of you might be already familiar with these functions because it is the traditional way of doing things. For these purpose you may use any one of the Transfer function based on your requirement.

If you want to transfer to another page in the same component, it is advised that you use the tailored function TransferPage(). If you are planning to navigate away to a page in another component then you have the functions Transfer(), TransferExact(), TransferNode() and TransferPortal(). If you are already sure of the keys for the new component, then you can directly use the TransferExact function to save some processing time. If you are not completely sure about the search keys for the new component, then it is advised that you use Transfer function. The later two functions are not that frequently used. If you have some weird scenarios like you want to transfer to a different node or portal, then you may use TransferNode and TransferPortal functions respectively.

The syntaxes of the functions mentioned here are as below.

TransferNode(new_instance, 
      NODE.nodename,
      MENUNAME.menuname, 
      MARKET.marketname,   
      COMPONENT.componentname, 
      PAGE.component_item_name, 
      action [, keylist]);


TransferPortal(new_instance, 
      PORTAL.portalname,
      NODE.nodename,
      MENUNAME.menuname, 
      MARKET.marketname,   
      COMPONENT.componentname, 
      PAGE.component_item_name, 
      action [, keylist]);


Transfer(new_instance,
        MENUNAME.menuname,
        BARNAME.barname,  
        ITEMNAME.menu_itemname,
        PAGE.component_item_name,      
        action [, keylist] [, AutoSearch]);


TransferExact(new_instance,
        MENUNAME.menuname,
        BARNAME.barname,  
        ITEMNAME.menu_itemname,
        PAGE.component_item_name,      
        action [, keylist] [, AutoSearch]);


TransferPage([PAGE.page_name_name]);



These are some of the commonly used navigational functions and their general use cases. You can still make wonders by mixing scenarios with the type of functions used. If you feel there is some better use case for any functions or vice verse, drop your comments in the comments section.

4 comments:

  1. Hi, very interesting your post. I want to ask this ?

    there is a way open a URL in a different browser to IE from PeopleCode, for exaple using this funtion:

    ViewContentURL(&URL, True);

    I have understood that handles javascript:

    ViewContentURL("\\\\PT-NFS01\\PSUSERWS\\TEMP\\TVN\\81X-PATCHES.TXT");

    But it is possible to do this ?

    ReplyDelete
    Replies
    1. Yes, that should be possible. You have to first write a script for opening a different browser window (google will help) and then save the script as a HTML object on app designer. Now you could use ViewURL function and the URL for the script can be achieved from a built in function which sounds like GetJavaScriptURL.

      Hope This helps.

      Thanks,
      Tony

      Delete
  2. Using the Transfer function to transfer to a different component, how can we change the highlighted content reference within the menu (structure and content)? If I navigate to component A, in the menu on left side of screen, the content reference for component A is highlighted. When I use the Transfer function to transfer to component B (in same window), when component B opens, the menu focus does not change and content reference for component A is still highlighted.

    ReplyDelete
    Replies
    1. The menu display structure of the peoplesoft components have undergone drastic changes from tools release. Since you refer to the left hand side navigation I assume that you may be using an old version. If you upgrade to the latest version you will be surprised to see no such menu structure and your question wont stand in that context.

      Coming back to your original question, I am afraid that it may not be possible with the Transfer function. The best alternative to solve the problem would be to use ViewURL instead of the transfer.

      -Thanks
      Tony

      Delete

Followers