Tuesday, April 11, 2017

Fluid UI - Tile Wizard API for Dynamic Tile Content

PeopleTools 8.55 introduced the Tile Wizard App Classes which enable us to use the API to dynamically modify Tile Content.

PeopleBooks: Tile Wizard Classes

There are three main areas in the Tile where we can add dynamic content - Tile Content, Live Data and Badge.

Here is an example of how we can use the Tile Wizard Classes to dynamically update the content of a Tile as shown in the example below.


Step 1: Implement a custom App Class that extends PTGP_APPCLASS_TILE:Tiles:Tile



Notes:
- Make sure the App Package contains a Sub Package. Otherwise, we might run into errors as stated in this HEUG Technical Forum discussion.
- We can use the %This.SetTileContentAs... methods - %This.SetTileContentAsTwoKPIs() in this case - to override the "Tile Content Type" configured using the Tile Wizard (which we will perform in step 2).
- We can also use the various Tile Class Properties to set the Tile Content (e.g.: KPI values and labels), Live Data (values, trend image and metrics formatting) and Badge Data.

Step 2: Create Tile using Tile Wizard

NavBar > PeopleTools > Portal > Tile Wizard > Create Tile



Notes:
- We can see that the App Class created in step 1 is referenced as the Data Source.
- Also, the "Tile Content Type" is set to Image in the Wizard configuration level (although it will be overwritten using PeopleCode).
- Similarly, the "Tile Badge" is set to "No" in the Wizard configuration but it can be overwritten using PeopleCode.


Note:
- For the purposes of this example, I set the Target Page to "PS Unit". This can be set to anything as per our requirement.


Note:
- The Tile image is set to PTFP_DEFAULT_CLOUD as a dummy. It will not be used in this case, because we will be overriding the "Tile Content Type" via PeopleCode.


Step 3: Add Tile to a Fluid Homepage

Fluid Home > Action Menu > Personalize Homepage


Results:


Environment Details:

- CS 9.2
- PUM Image 4
- PeopleTools 8.55.12

Related Posts:
Part 2
Part 3

PeopleCode for Reference:

import PTGP_APPCLASS_TILE:Tiles:Tile;

class TILE_1 extends PTGP_APPCLASS_TILE:Tiles:Tile
   method TILE_1();
   method getTileLiveData();
end-class;

method TILE_1
   %Super = create PTGP_APPCLASS_TILE:Tiles:Tile();
end-method;

method getTileLiveData
   /+ Extends/implements PTGP_APPCLASS_TILE:Tiles:Tile.getTileLiveData +/
  
   %This.SetTileContentAsTwoKPIs();
   /* 1 KPI tile content */
   %This.TileKPI_1 = %This.getAmountFormattedValue(1.23456789, "USD");
   %This.TileKPI_1_Label = "KPI1_1 Label";
   %This.TileKPI_2 = "KPI_2";
   %This.TileKPI_2_Label = "KPI_2 Label";
  
   /* Live Data */
   %This.TileLiveData_1 = "LD_1";
   %This.TileLiveData_2 = "LD_2";
   %This.TileLiveData_3 = "LD_3";
  
   /* A trend arrow is an optional element of live data. */
   %This.hasLivedataTrendImage = True;
   %This.TrendImage = %This.k_strTrendDownImage;
  
   /* Metrics Formatting */
   %This.isTileLiveData_1_Metrics = True;
   rem %This.isTileLiveData_2_Metrics = True;
   rem %This.isTileLiveData_3_Metrics = True;
  
   /* Badge */
   %This.hasLiveDataCount = True;
   %This.TileTransCount = 7;
  
end-method;

54 comments:

  1. Hi there! First off, great tutorial! Already thinking of all the things I can do with this.

    I'm curious, is there anyway to control properties of the tile itself like height and width? Or is that only possible through the CRef you select?

    ReplyDelete
    Replies
    1. another question, is it possible to disable the link to the CRef? Disabling the main hotspot seems to override the custom app package.

      Delete
    2. Hi Eric - Good questions! The first one would be a great enhancement idea. I don't think there is any way we can dynamically adjust the Tile dimensions. Interesting thing I found is that once we use the tile wizard, the Tile CREF that is generated no longer has the 'Fluid Attributes' tab, since it is created as a CREF link. We will need to adjust the properties on the underlying CREF.
      Refer CREF Link: https://snag.gy/0TcgGs.jpg
      Refer CREF: https://snag.gy/W3hvUc.jpg

      You second question is actually worth a separate blog post! :)

      I found the solution to your problem, instead of setting the 'Disable Main Hotspot' on the Tile Wizard, go to the actual CREF that you would end up on (in my example https://snag.gy/K9LP5E.jpg) when you click on the Tile and set the 'Disable Main Hotspot'.

      Let me know if this makes sense!

      Delete
    3. This comment has been removed by the author.

      Delete
    4. Hi Sasank,

      Is there anyway that could disable hotspot dynamically through Peoplecode.

      Actually, I've written an app package which returns an HTML area for on a tile and also when clicked on it goes to a Nav Collection. On certain criteria, the tile should be disabled. Is there anyway I can achieve this?

      I'm not sure, if I can use a function or any sort of such to disable the tile.

      Thanks!



      Thanks@

      Delete
    5. I just see a property SetGroupletDisplayIn(). Is there any way we could use this in getTileLiveData function in App package

      Delete
    6. This comment has been removed by the author.

      Delete
  2. Hi Sasank, I am getting a error when attempting dynamic content on a tile...in step 3 of Tile Wiz when I tried to select my Content Ref, I am getting an error "There is no current buffer context." Have you seen this before? I traced it back to the SetCRefListArea function that uses Getlevel0() but somehow my new CF for the tile is blowing it up...have you seen this before or have you tried with a new CF instead an existing one? Thanks!

    ReplyDelete
    Replies
    1. Nevermind...the client had 8.55.08 tools on 9.1. I tried the same in 8.55.09 in 9.2 and it worked fine. Now applying patch for 8.55.15...

      Delete
    2. Ricky - Thanks for letting us know! Glad to hear that you figured it out.

      Delete
  3. Hi Sasank,

    Is there a way wherein if I click the tile, it will skip the search page of the component because the search fields will be populated already in the code.

    ex. Clicking tile1 will direct the user to component1 with institution1 as the search value. Clicking tile2 will direct the user to component1 with institution2 as the search value.

    ReplyDelete
    Replies
    1. When you say, "because the search fields will be populated already in the code"? To understand this correctly, can you explain what code you are referring to?

      You could pass the search key as a parameter in the CREF or CREF link. Then use different CREFs with different parameters for your search key and use them as your tile1 and tile 2 content.

      Delete
  4. How do we migrate the tiles to a project?

    ReplyDelete
    Replies
    1. You can use Data Migration Workbench to migrate Tile Wizard Tiles. PTPPB_GROUPLET is the delivered data set definition to migrate Tile Wizard data.

      Refer following document on My Oracle Support:
      E-FLUID : Migrate Fluid Tile (Doc ID 2213853.1)

      Delete
  5. Looks like there is an error with the above code.
    The error says: Inappropriate use of %Super. (2,83)

    Could you please suggest?

    ReplyDelete
    Replies
    1. Not sure what is causing this error.

      The code is based on this PeopleBook and I have not seen this error in 8.55. What tools version are you on?

      https://docs.oracle.com/cd/E66686_01/pt855pbr1/eng/pt/tpcr/task_ImplementingAnApplicationClassForTileContent.html?pli=ul_d57e1337_tpcr

      Delete
    2. I got the same error when I tried to copy paste this code (without changing the class name and constructor name in the code to match my class).

      Hope this helps. Thanks!

      Delete
  6. Hello Sasank,

    How do we copy a homepage of one user to another user?

    ReplyDelete
    Replies
    1. You could use the 'Publish Homepage' option to share a homepage created by one user to another.

      Refer:
      https://docs.oracle.com/cd/E66686_01/pt855pbr1/eng/pt/tprt/task_ManagingHomepages-c072ad.html#u551de682-b041-4373-a1a7-be78a1641a81

      Delete
  7. Hello Sasank

    Is there any way to create a tile that defaults for all users that links to a single peoplesoft component?

    ReplyDelete
    Replies
    1. Yes. You can add security to the Tile Content Reference to provide access to all users by picking a Permission List or Role that is available to all users. Alternatively, you could make the tile 'Public'.

      To the second part of your question. You can create a content reference or content reference link under PeopleTools > Portal > Fluid Structure and Content > Fluid Pages, and point that to the component you want the tile to link to.

      Hope this makes sense.

      Delete
  8. Hello Sasank

    We would also like to create a "Help" tile that links to a PDF file that we would host on our webserver. Is this possible?

    ReplyDelete
    Replies
    1. I have not tried this but it should be possible.

      Again, you will need to create a content reference (as an external link) under the Fluid Pages folder (in structure and content) and point to the pdf file.

      Delete
  9. Hi Sasank,

    First of all.. it works great!
    But when I put it into another environment, the user doesn't seem to have rights to see the live data on the tile. It seems like there is a security on the application class PTGP_APPCLASS_TILE.
    The component behind the tile is reachable, but the tile says: 'You are not authorized for this page.'

    Do you have any idea what this could be?

    ReplyDelete
    Replies
    1. @Jaimee-Lee Kleeman Very good question! I was clarifying this exact topic to my colleagues yesterday! :)

      Yes. There is actually an additional layer of security. When we use the tile wizard, we add the tile (CREF) to a folder under (Root > Fluid Structure and Content > Fluid Pages) in step 3 of the activity guide. In my example above, my tile CREF object name is TTS_UNIT_TEST and it resides in 'PeopleSoft Applications' folder (parent).

      Even though we have access to the underyling component, we also need to have access to this Tile CREF contained with 'Fluid Pages' sub folders. Basically, we need to go to this CREF object and add the appropriate roles/PL to this CREF using the 'Security' tab.

      Let me know if this works/makes sense. Thanks!

      Delete
  10. Hi Sasank,

    I have found the problem. We have a very strict security and the logged user didn't had access to the PTGPLT_APP_TILE_FL component (This is the component of the LiveData).

    So I was very confused because everything seemed to be ok according to your response.

    Thank you anyway!

    ReplyDelete
    Replies
    1. Yes. I totally forgot about that component. So, there is another layer of security if we are using dynamic tiles using Tile Wizard API!

      Thank you for this information. I am sure this will be useful for others.

      Delete
  11. hello Sansank, I'm using SetGroupletDisplayIn() to enable a tile through Peoplecode, it is not changing the mouse pointer to little pointer symbol. It is showing as arrow only and not the little hand pointer. Is there any setting or any property which would assign this?

    Thanks!

    ReplyDelete
    Replies
    1. I am not sure. I have not used that property. You may want to reach out to Oracle Support for clarification.

      Delete
    2. I am not sure if we can do that using the Tile Wizard API. I don't see any property/method that fits your requirement.

      You may want to contact Oracle Support and/or post your question in the My Oracle Support Community, in case anyone has additional ideas:
      https://community.oracle.com/community/support/peoplesoft/peopletools_-_psft

      Thanks!

      Delete
  12. Hi Sasank,

    I have requirement to perform transactions based on the Home Page that the user is on, in Classic %HPTabName will give me the Home page Information from which we can base our logic to work.

    Now in Fluid, the home page is always being DEFAULT. Is there any functions specific for finding the Fluid Homepage or a way in which we can have the above logic framed ?

    Any Help would be much Appreciated !

    Thanks in advance.

    ReplyDelete
    Replies
    1. Take a look at this post:
      https://pe0ples0ft.blogspot.com/2017/11/deep-linking-to-a-fluid-homepage.html

      This may not be directly a solution for you but hope you can build your logic based on the information in this post.

      Delete
  13. Hey Sasank,
    We are upgrading from people tools 8.54 to 8.56 (PUM 24) and we have an issue. In classic view we are NOT seeing delivered fluid components in menu like root >> change my password, PeopleTools >>Portal >> Tile Wizard. We are using portal >> structure and content and test content reference link to navigate to these components. We are able to accomplish this in few test environments and not in some. Are there any setting/configuration? Any help/suggestion greatly appreciated.

    Regards
    Ram Devender

    ReplyDelete
  14. Hi Sasank,

    How can we display HR Announcements on a Tile? The same is available in delivered pagelet but I convert this pagelet to Tile, the announcements get visible once the tile is clicked, and not on the tile itself.

    Thank you,
    Swati D

    ReplyDelete
  15. Hi Sasank,

    The tile is not displaying the live data sometimes ,that is when you comeback to the homepage from any of the other tiles in people tools version 8.56.10.

    We observed that ,only the first tile in the homepage has this issue.

    Can you please provide any work around for the same.

    Thanks,
    Naresh

    ReplyDelete
  16. Hi,
    Is it possible to let a dynamic tile point to a navigation collection?

    * this example: as "Data Yype" you choose for "Application Class"
    * a normal tile pointing to a navigation collection has as data type "Navigation Collection"

    Kind regards, Bart

    ReplyDelete
    Replies
    1. Yes. You can create a CREF that points to your nav collection. Use that CREF as the target page. In my case, I am using "PS Unit" as the target page, you can replace that with anything.

      Delete
  17. Hi Sasank,

    Is it possible to conditionally control the disable main hotspot and interactive property through peoplecode ?

    ReplyDelete
    Replies
    1. I have used Event Mapping on the PT_LANDINGPAGE Activate event to dynamically change the content of a tile in such scenarios.

      The concept is very similar to a trick which I learned on this thread:
      https://community.oracle.com/thread/4052095#thread-message-14430289

      Delete
  18. Hi Sasank,

    How do we Publish the tile with same CREF which is already there as we have Approvals tile already and if we want the custom tile to have same CREF as Approvals one, then it is showing the warning of Potential Overwriting.

    ReplyDelete
    Replies
    1. That is right. CREFs are unique.

      Also, when we create/publish a Tile using Tile Wizard, it basically creates a CREF under PeopleTools > Portal > Structure and Content > Root > Fluid Structure and Content > Fluid Pages > Destination Folder.

      Two ways to work around the issue:
      1. Create a CREF link under Fluid Pages that points to the delivered CREF.
      2. Create a 'cloned' version of the CREF and add an additional/dummy parameter (e.g.: &CUST=Y) which will make the CREF unique.

      Delete
  19. How do we display 0 on the Trans count on the Bottom right corner of the tile ?

    ReplyDelete
    Replies
    1. Refer image in Step 1.

      The number 7 is displayed by the following code.

      /* Badge */
      %This.hasLiveDataCount = True;
      %This.TileTransCount = 7;

      Delete
    2. No when the count is 0 it is not displayed on the tile , i want the number 0 to be displayed on the tile.
      I checked the Oracle support they mentioned its a Peopletools Bug, do we have a workaround for the same?

      Delete
    3. Thanks. I did not run into this was a bug. Can you please share the bug/doc id on MOS that refers to this issue?

      The only workaround that I can think of is to create your own Component/Page as the Dynamic Tile Content (instead of using the App Class approach). This would be customization free.

      Alternatively, debug the delivered Component/Page and customize/use event-mapping to workaround the display zero issue.

      Delete
  20. Hi Sasank,
    How do we assign security to the tiles based on the Roles users have?
    Like the display of the tile is to be controlled based on security.

    ReplyDelete
    Replies
    1. You can control this using security on the Tile's content reference definition.

      You can also set this up in the Tile Wizard:
      https://docs.oracle.com/cd/E87544_01/pt856pbr1/eng/pt/tprt/task_UsingTileWizard.html?pli=ul_d69e217_tprt#ud5f9ae63-5f5c-46b4-a076-afa0d88f09ae

      Delete
  21. Hi Sasank,
    Is there a way to have a tile with a Pivot chart and a filter drop down within the tile. And one user selects different value in the drop down, the content of the tile should refresh.
    Thanks.

    ReplyDelete
  22. I have a fluid pivot grid tile that otherwise functions well. The only downside is that I want it to display only the image that I choose in configuration because the data that it displays is largely irrelevant to our users. Is there a way I can get it to only display the image I select? We're on tools 8.56

    ReplyDelete
  23. Hello, 1) Is it possible to create the content reference manually in structure and content without Tile Wizard when the tile is using an app class to display live data? 2)If not, how is the content reference tied to the Tile Wizard setup? I dont see a reference to the tile wizard data on the content reference. Basically I would like to use Generic URL and also use the live app class tile data. That doesn't seem to be possible in Tile Wizard as it requests a content reference. Thanks, much appreciated and great blog!

    ReplyDelete
    Replies
    1. Hi Rajani,

      1. Yes. You can create a CREF and setup the dynamic content appropriately.
      2. You can setup the CREF to use live app class tile data without using the Tile Wizard. The Tile Wizard has its own metadata which is technically not necessary (if you don't want to use it). Just use the Fluid tab on the CREF to setup your App Class for the dynamic tile content.

      Here is a blog by Jim Marion where he discusses the Tile Wizard metadata.
      http://blog.jsmpros.com/2020/04/fluid-navigation-collection-tile.html

      Let us know the approach I suggested works for you.
      Thanks,
      Sasank

      Delete
    2. Good to know. I still don't see how you enter which app class you would like to use on the Fluid Tab. I probably need to find the right URL attributes. Thanks for help and good to know I am on the right track.

      Delete
    3. Rajani - I take back my previous comment.

      Looking into this further, you are right. The Tile Wizard metadata might actually be necessary for us to leverage the Tile API for dynamic content. We could forego it for Nav Collections, etc. But as you mentioned, I am not seeing where the App Package information is referenced to make this happen. This is not parameterized unfortunately.

      You can look at the code in PTGPLT_APP_TILE_FL for more details.

      To summarize, you will need the Tile Wizard metadata to use the Tile API.
      Sasank

      Delete