In the past, I wrote about how we can add custom links to the Branding - Action Menu at the system level.
Refer: Adding Custom Links to Fluid Branding
While testing this feature, I found that these custom links do not work in certain scenarios. For example, clicking those links from within the NUI Activity Guide framework (which is also used in Nav Collections).
I originally used the FieldChange event and the Response Class RedirectURL method to implement the redirection logic in Fluid Branding as shown below.
Since the Response Class RedirectURL method proved to be problematic in certain scenarios, I started investigating other options. In the process, I found this great delivered JavaScript function called DoURLWarning which is part of PT_HISTORY object in 8.55+ (PT_PAGESCRIPT_FMODE object in 8.54).
DoURLWarning function allows us to redirect to a URL using javascript. Additionally, the function will take care of checking for any unsaved data in the current page and if there is any it will display the "Save Warning" message. If not, it will redirect to the URL in the parameter list.
To use the DoURLWarning function, I removed all the redirect logic from the FieldChange Event. And added code in the RowInit event (as shown below) to utilize the DoURLWarning in combination with the Field Class JavaScriptEvents Property.
PeopleCode for reference
Demo
As we can see in the demo video, the custom link on the Action Menu works when invoked from the Activity Guide framework (which is also used in Nav Collections). The same approach described above can be used to implement custom links to internal PeopleSoft pages as well (e.g.: Process Monitor, Report Manager, etc.).
Save Warning Demo
Fluid UI New Window Feature Implementation
I used a similar technique as described above to implement the 'New Window' feature in Fluid UI as a custom link on the Branding - Action Menu.
Refer: Fluid UI - New Window Feature - Workaround
The only difference in the implementation is that instead of using the Response Class RedirectURL method (which would redirect/replace within the current window), I used the ViewContentURL method to open a new window as shown below.
We can see in the demonstration below, that the same problem described for the custom links also exists for this New Window implementation.
To workaround the problem, I took a similar approach and removed the existing logic from the FieldChange event and moved it to the RowInit event. In the RowInit event, I used the Field Class JavaScriptEvents Property in combination with the Window interface's open method as shown below. Additionally, I also updated the logic to include the %Request.QueryString to the URL to make sure that none of the additonal parameters are lost when opening the new window.
PeopleCode for reference
Demo
Refer: Adding Custom Links to Fluid Branding
While testing this feature, I found that these custom links do not work in certain scenarios. For example, clicking those links from within the NUI Activity Guide framework (which is also used in Nav Collections).
I originally used the FieldChange event and the Response Class RedirectURL method to implement the redirection logic in Fluid Branding as shown below.
Since the Response Class RedirectURL method proved to be problematic in certain scenarios, I started investigating other options. In the process, I found this great delivered JavaScript function called DoURLWarning which is part of PT_HISTORY object in 8.55+ (PT_PAGESCRIPT_FMODE object in 8.54).
DoURLWarning function allows us to redirect to a URL using javascript. Additionally, the function will take care of checking for any unsaved data in the current page and if there is any it will display the "Save Warning" message. If not, it will redirect to the URL in the parameter list.
To use the DoURLWarning function, I removed all the redirect logic from the FieldChange Event. And added code in the RowInit event (as shown below) to utilize the DoURLWarning in combination with the Field Class JavaScriptEvents Property.
PeopleCode for reference
Demo
As we can see in the demo video, the custom link on the Action Menu works when invoked from the Activity Guide framework (which is also used in Nav Collections). The same approach described above can be used to implement custom links to internal PeopleSoft pages as well (e.g.: Process Monitor, Report Manager, etc.).
Save Warning Demo
Fluid UI New Window Feature Implementation
I used a similar technique as described above to implement the 'New Window' feature in Fluid UI as a custom link on the Branding - Action Menu.
Refer: Fluid UI - New Window Feature - Workaround
The only difference in the implementation is that instead of using the Response Class RedirectURL method (which would redirect/replace within the current window), I used the ViewContentURL method to open a new window as shown below.
We can see in the demonstration below, that the same problem described for the custom links also exists for this New Window implementation.
To workaround the problem, I took a similar approach and removed the existing logic from the FieldChange event and moved it to the RowInit event. In the RowInit event, I used the Field Class JavaScriptEvents Property in combination with the Window interface's open method as shown below. Additionally, I also updated the logic to include the %Request.QueryString to the URL to make sure that none of the additonal parameters are lost when opening the new window.
PeopleCode for reference
Demo
Hi Sasank...
ReplyDeleteI noticed the same thing and had not taken the time to investigate. I tried implementing your revision and while it opens the new window properly, it seems to destroy the original window. My original tab still has the same URL, but the page goes to a blank page with [object] on it in the upper left. Any clue what could be causing that?
Oh, and this seems to be an issue with IE and Firefox, but not chrome. We're running IE 11.0.9600.18977. Firefox actually changes the URL on the original page to the javascript command and leaves a [object Window] message on the page itself.
@MMiszewski - Good catch. I updated the PeopleCode to use onclick instead of href in the JavaScriptEvents value. This seems to fix the issue which you reported. I also updated the PeopleCode screenshot and GitHub gist to reflect this change.
DeleteLet me know if you run into any issues with the updated code.
Hi Sasank,
ReplyDeleteThis is great, thank you. I've also been trying to get an internal link from a fluid page to open in a new window but it seems that no longer works either. I need to go to a classic page passing current data but no matter the setting it opens in the current window.
Hi Sasank,
ReplyDeleteI have actually run into an additional issue. It appears to be related to passing of Query Strings. Oracle uses what I call a Navigation Landing Page method with their delivered Self Service Tiles. The initial link is to a Start Page component which has parameters that control the Navigation Collection to load into tabs and the adjusts for SFF and LFF. If you go to the Profile tile for instance and try the New Window menu item, you get a page of XML code. The URL is built for the page associated with the tab versus the original start page and there is a series of extra query strings (e.g. "&ICAJAX=1&ICMDTarget=start&ICPanelControlStyle=%20pst_side1-fixed%20pst_panel-mode%20". If I strip off those extra values, the base component opens outside of the Nav Collection style motif created by their landing page. Ideally, I would think I would want the start page to be used for the new Window, but apparently is not available in this mode. The other option I'm considering is forcing the new fluid window to the home page. I would be interested to know your thoughts on the subject.
Hi Sasank, this does not appear to work with tools 8.57 or rather it does work but always pulls the first item on the Nav collection for the new window.
ReplyDeleteHello Sasank,
ReplyDeleteI tried this in PT8.60 and it works, but only on PSC portal pages. I tried adding a button to the PT_HEADER_ACTION page (the action menu) and it does work initially, but every time a user navigates to a PSP page (mostly anyone of the classic PIA pages/components), the button disappears. When navigating back to a PSC pages, the custom button re-appears...
Any suggestions?