Showing posts with label 'Add to' functionality. Show all posts
Showing posts with label 'Add to' functionality. Show all posts

Monday, June 3, 2019

Display 'My Favorite Queries' in NavBar 'Favorites'

The following question was posted on one of my blog posts:
https://pe0ples0ft.blogspot.com/2018/09/decoupling-add-to-functionality.html#c9053788640685351670

Question: Is there any way to add my favorite queries into the MyFav in fluid via code dynamically?

To provide some context, the delivered 'My Favorite Queries' feature within the 'Query Manager' page allows users to favorite/bookmark frequently used queries. We can see a demo of this feature in the video below.

Add To 'My Favorite Queries'


The requirement here is to dynamically display the user queries from 'My Favorite Queries' as links/shortcuts in the NavBar - 'Favorites' tile content.

I am sure there are many ways we can achieve this programmatically. As a proof of concept, I used Event Mapping Framework to execute additional custom logic on PTNUI_MYFAV_COMP component PostBuild event. This approach will be customization free!

Why PTNUI_MYFAV_COMP component? Because it is the PeopleTools delivered component used to render the NavBar - 'Favorites' tile content. We can see the content reference PTNUI_NB_FAV that is associated with the PTNUI_MYFAV_COMP component in the screenshot below.


In the custom Event Mapping App Class - which is configured to execute as as post process to the PTNUI_MYFAV_COMP component PostBuild event, I simply appended the current user's 'Favorite Queries' to the NavBar - 'Favorites' Content Collection. We can see a demonstration of 'My Favorite Queries' displayed in the NavBar - 'Favorites' below.

Demo of solution


Implementation Details

Download App Designer Project from GitHub: https://github.com/SasankVemana/MyFavQueriesAsNavBarFavorites

Notes:
  1. This feature (implemented using Event Mapping Configuration) is a great value addition to users who frequently use PS Query. That said, all users are not alike and some may not prefer to see all the queries they stashed away in their 'My Favorite Queries' displayed under the NavBar - Favorites. For the purpose of a proof of concept, this solution is implemented for all users. But it could very easily be extended to only display the 'My Favorite Queries' if the users 'opt in'. Please consider any user experience impacts prior to implementing this solution or something similar.
  2. This solution was created using HCM 9.2 - PUM Image 29 - PeopleTools 8.57.03.
Event Mapping App Package/Class

The following Event Mapping App Package/Class contains the custom logic to display 'My Favorite Queries' in the NavBar - 'Favorites' tile content.


SV_EVENT_MAPPING_PKG.NUI.AddMyFavQueries.OnExecute

This app class is mapped to the PTNUI_MYFAV_COMP component PostBuild event. The logic in the Execute method is very similar to that of PTNUI_MYFAV_COMP component PostBuild event.

SV_EVENT_MAPPING_PKG.Utils.PSQueryAsFavorites.OnExecute

This app class is used by the Event Mapping app class (refer line 19 and 20) to append the 'My Favorite Queries' to the NavBar - Favorites Content Collection. This app class is cloned from the delivered PTNUI.NavBarContentArea.Content.MyFavorites.OnExecute app class and updated to meet this requirement.

Dummy Content Reference SV_EXEC_PSQUERY_GBL

The following content reference (SV_EXEC_PSQUERY_GBL) was created as a placeholder. This content reference is required to be able to add a link to the NavBar - Favorites Content Collection. I chose to add this CREF under Root > Reporting Tools folder. You can move this to a different Parent Folder per your standards.


This CREF is referenced in SV_EVENT_MAPPING_PKG.Utils.PSQueryAsFavorites.OnExecute (line number 30 and 31) as shown below.


Helper Function - AppendContentArea

This function is called by the custom event mapping app class (line 22) to append a Collection to NavBar Content Area. The logic in this function is cloned/borrowed from the delivered SetContentArea function in PTNUI_DOCK_REC.PTNUI_NB_ACTION.FieldFormula.


Related Content Service Definition


Event Mapping Configuration



Tuesday, September 18, 2018

Decoupling the 'Add to' Homepages, Favorites and NavBar Functionality

As delivered, the 'Add to' functionality - Add to Homepage, Add to NavBar, Add to Favorites, which is available in the New User Interface (NUI) is all or nothing. That is how it works as designed in PeopleTools.


What this means is that, we cannot simply remove access to 'Add to Homepage...' while allowing access to 'Add to NavBar' and/or 'Add to Favorites'. Basically there is no granularity in the security access. The access to the 'Add to' functionality is mainly controlled via the following weblib from a security point of view:
WEBLIB_PTNUI.PT_BUTTON_PIN.FieldFormula.IScript_SavePin

Note: There are some other configurations that may impact the display of the 'Add to' options. Refer MOS Doc ID 1983068.1 for more details.

My Oracle Support Reference Documents
E-FLUID: How To Restrict Users From Adding Homepages or Tiles in Fluid Homepages (Doc ID 1983068.1)
Bug 26290030: THE ADD TO FUNCTIONALITY NEEDS ENHANCEMENT

Clearly, this is not ideal. I worked on a requirement recently to decouple the security for the 'Add to' functionality. This also seems to be a common request among other PeopleSoft customers as well. For example: https://community.oracle.com/message/14937074#14937074

Here are the steps to decouple the 'Add to' functionality.

Step 1: Create a custom weblib

The IScripts in this custom weblib are primarily for dummy purposes. We can see that there is no code in the IScript.


PeopleCode Snippet for Reference:

Step 2: Update IScript_ShowPinMenu

This customization will take care of the 'Add to' functionality in Classic.


PeopleCode Snippet for Reference

Step 3: Update PT_HEADERPAGE.Activate (Page PeopleCode)

This customization will take care of the 'Add to' functionality in Fluid.


PeopleCode Snippet for Reference

Step 4: Security Configuration

Provide Full Access to the following delivered IScripts:
WEBLIB_PTNUI.PT_BUTTON_PIN.FieldFormula.IScript_ShowPinMenu
WEBLIB_PTNUI.PT_BUTTON_PIN.FieldFormula.IScript_SavePin

 This is to provide the delivered 'all or nothing' access to the delivered 'Add to' functionality.


Now we are ready to control the decoupled 'Add to' functionality using the custom weblibs. We can selectively provide granular access to the following custom weblibs based on our requirements.
Add to Homepage: WEBLIB_CSK_PIN.ISCRIPT1.FieldFormula.IScript_AddToHomepage
Add to NavBar: WEBLIB_CSK_PIN.ISCRIPT1.FieldFormula.IScript_AddToNavBar
Add to Favorites: WEBLIB_CSK_PIN.ISCRIPT1.FieldFormula.IScript_AddToFavorites

In the example below, I am choosing to provide access to 'Add to NavBar' and 'Add to Favorites' but not to 'Add to Homepage'.


Results

Fluid Page:


Classic Page:


Environment Details
- HCM 9.2 PUM Image 25
- PeopleTools 8.56.05