Hiding or Displaying Tiles Using an Application Class

You can define a custom application class to hide or display tiles on fluid homepages and dashboards.

Note: Once a tile has been configured with this custom application class, the tile is no longer available on the Add Tile page for users to search for or add the tile. In addition, the tile can no longer be moved or deleted when configured on a homepage in this manner.

To hide or display tiles using a custom application class:

  1. Write application class PeopleCode that extends the PTGP_APPCLASS_TILE:API:TileAppFilter base class.

  2. Implement the IsTileVisible method to contain application-specific logic that hides or displays tiles based on your business requirements. To the extent possible, write lightweight application logic to avoid issues with loading fluid homepages or dashboards that include multiple tiles that employ a tile filter.

    The following example provides a simple implementation of PTGP_APPCLASS_TILE:API:TileAppFilter:

    import PTGP_APPCLASS_TILE:API:TileAppFilter;
    
    class MyFilter extends PTGP_APPCLASS_TILE:API:TileAppFilter
       method IsTileVisible(&cref As ApiObject) Returns boolean;
       
    end-class;
    
    method IsTileVisible
       /+ &cref as ApiObject +/
       /+ Returns Boolean +/
       /+ Extends/implements PTGP_APPCLASS_TILE:API:TileAppFilter.IsTileVisible +/
       
       /* Application-specific logic to hide or show a tile. */
       If IsUserInPermissionList("PTPT1000", "PTPT1600") And 
             &cref.Name <> "PORTAL_ROOT_OBJECT" Then
          Return True;
       Else
          Return False;
       End-If;
    end-method;
    

    Update the content reference definition for the tile to include TILEAPPFILTER as a content reference attribute.

    Set the attribute value to your custom application class. For example:

    This example demonstrates how to set the TILEAPPFILTER content reference attribute.

    Example of the TILEAPPFILTER content reference attribute
  3. Update the fluid homepage definition in Fluid Structure Content > Fluid Homepages. On the Tile Content page:

    1. Select the check box for the tile in question.

    2. Select one of these options only: Opt-Dflt, Req-Fix, or Required.

      Important! Do not select Optional. The tile will not be displayed automatically on user’s homepages and users will not be able to search for and add the tile.

    3. Save the homepage definition.

      Once a tile has been configured this way on a homepage, it cannot be reconfigured:

      Homepage definition with TILEAPPFILTER configured

      To restore the default behavior of this tile, remove the TILEAPPFILTER content reference attribute on the tile’s content reference definition.

The use of the IsTileVisible method has the following limitations:

  • In a cluster environment, the TileAppFilter.IsTileVisible logic is only available if you are logged in to the node where the tile is defined directly. If the tile is added as a remote node, it will behave like a conventional tile, and the TileAppFilter.IsTileVisible logic is not executed.

  • In fluid homepages, the TileAppFilter.IsTileVisible logic is only executed once during a login session when the tile is initially loaded (typically at login) as the homepages are cached. However, dashboards evaluate the TileAppFilter.IsTileVisible logic every time the dashboard is loaded.