Wednesday, October 24, 2018

PeopleTools 8.57 | Custom Banner/Company Info Configuration - Part 2

In my previous post, I wrote about how to get started with the new Custom Banner/Company Info feature which is now part of PeopleTools 8.57.01.

This post details additional code changes that are necessary to workaround some caching issues. This would be useful for those who plan to use the early release of 8.57.

The following App Class PeopleCode is used by the Company Info functionality:
PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute


This App Class is referenced in PT_HEADERPAGE.PageActivate for the display of the Company Info in Fluid:


If we review the App Class (GetCompanyInfoHtml) PeopleCode, we will find that the Branding framework uses Rowset Cache functionality which is a great way to improve performance for fairly static content!

More details on Rowset Cache, usage and associated benefits can be found in PeopleBooks:
Rowset Cache

The disadvantage of using Rowset Cache is that we need to carefully code and make sure that we refresh the data (in the cache) as and when it is appropriate/necessary. Otherwise, we will have situations where cache gets stale but it continues to be referenced, causing a variety of problems. One such problem/scenario exists with the code in the GetCompanyInfoHtml App Class.

Excerpt from PeopleBooks


Problem Scenario

Let us say, that we went through all the steps described in my previous blog post and created our own Custom Banner (CompanyInfo configuration) in PT 8.57. Now, that we implemented the Company Info functionality, let us say we want to revert back to the delivered theme DEFAULT_THEME_FLUID. This delivered theme is unchanged and does not contain any CompanyInfo configuration.

As you can see in the following screenshots and demo video, even though we have revert to the DEFAULT_THEME_FLUID theme (without any CompanyInfo configuration), there is a Rowset Cache related problem which persists the previous CompanyInfo configuration in Fluid.

Branding System Options and Assign Themes Configuration



Demo

We can notice the Rowset Cache related issue in this demo. The issue will persist in this scenario regardless of how many times web/app server and browser cache is cleared because the issue is related to stale Rowset Cache.


Cause

There is code in the GetCompanyInfoHtml App Class that assumes:
  1. There is only one and only one Header definition with the CompanyInfo element configured. It is a no brainer that we certainly can have more that one Header definition with the CompanyInfo element configured.
  2. If a CompanyInfo element is configured on a Header definition, then that Header definition is currently used in the Default Theme set in the Branding System Options (and Assign Themes) Configuration. It is not necessarily the case that we are currently using a theme with the CompanyInfo element just because one exists.
Both these assumptions can be false as demonstrated in the demo in this post.

Assumption 1
 
PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute
Method: GetFluidBannerHtml


PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute
Method: GetClassicBannerHtml


Assumption 2

PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute
Method: GetFluidBannerHtml


PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute
Method: GetClassicBannerHtml


Custom Code Fixes

Addressing Assumptions

The following PeopleCode updates will ensure that only the current Header definition (PTBR_LAYOUT_ID) is included in the Rowset cache.

PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute
Method: GetFluidBannerHtml


PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute
Method: GetClassicBannerHtml


Refreshing Rowset Cache when required

PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute
Method: GetFluidBannerHtml


PTBR_BRANDING.UTILITY.GetCompanyInfoHtml.OnExecute
Method: GetClassicBannerHtml


PeopleCode for Reference
Complete PeopleCode is provided for reference at the end of this post.

Solution

As we can see in the demo (after applying the code changes), as soon as we switch from a CompanyInfo based theme to a non-CompanyInfo based theme, the Rowset cache is automatically updated and the changes take effect right away. It does not even require a logout!

Demo


Customization of PTBR_BRANDING.UTILITY.GetCompanyInfo.OnExecute (8.57.01)

No comments:

Post a Comment