Tuesday, August 23, 2016

Branding 8.54+ - Role Based Theme Assignment/Override

In the past, I have written about Branding PeopleSoft applications using themes (and even theme macro sets in PeopleTools 8.55). In this post, I want to quickly show how we can assign different themes to different users based on roles/permission lists.

Using the steps detailed in my previous post - PeopleTools 8.55 - Branding, I created two different themes (Red and Blue).

Note:
Although, I am using PeopleTools 8.55, the same - User Attribute Based Theme Assignments - can be done using PeopleTools 8.54 themes as well.

The two themes have the following look and feel. I only updated the background color of the header to keep the themes simple. The idea is to demonstrate role based theme assignment/override. You could follow my other branding posts and make further theme changes as per your requirements.

Blue Theme:


Red Theme:


Environment Details: CS 9.2 PUM Image 2, PeopleTools 8.55.06

Assigning Branding Themes based on User Roles:

Branding System Options:

PeopleTools > Portal > Branding > Branding System Options

I left this as default for the sake of this proof of concept.


Assign Branding Themes:

PeopleTools > Portal > Branding > Assign Branding Themes



Again, for the purposes of demonstration and simplicity, I am using the delivered DEFAULT_THEME_FLUID theme as my default. Notice the 'Effective Date'? This means that we could potentially have certain themes only active for a specific period of time. For example, creating a football based theme specifically for students that is only effective during game week?


Further, you can see that I set the priority of the Red Theme higher (100) than the Blue Theme (200). This means that if a user has both CSK_RED_THM_ROLE and CSK_BLUE_THM_ROLE, the system would prioritize CSK_RED_THEME_FLUID as the user's theme.

Results:

User without CSK_RED_THM_ROLE or CSK_BLUE_THM_ROLE (Default):

This is a scenario where the user does not have any of the roles defined in the 'User Attribute Based Theme Assignments' section. The user simply gets the 'Default Theme'.


User with access to CSK_BLUE_THM_ROLE:

This is a scenario where the user has the role CSK_BLUE_THM_ROLE but not CSK_RED_THM_ROLE. So, the system assigns the CSK_BLUE_THEME_FLUID theme for this user.


User with access to both CSK_RED_THM_ROLE and CSK_BLUE_THM_ROLE:

This is a scenario where the user has both CSK_RED_THM_ROLE and CSK_BLUE_THM_ROLE. The system uses the priority configuration and assigns the CSK_RED_THEME_FLUID.


PeopleBooks Reference:
PeopleTools 8.54
PeopleTools 8.55

7 comments:

  1. Hey Sasank! Very nice demonstration of this functionality. This is super useful for universities that have multiple schools that each have their own color\branding scheme.

    ReplyDelete
  2. SASANK, have you assigned a different branding theme to the external candidate gateway using only 1 portal?

    ReplyDelete
    Replies
    1. Yes. You can add a different/unique role the external candidate gateway default user. This role should be unique and only present on the external candidate gateway default user account. Then use that role to assign a different theme. Using the approach described above.

      Delete
  3. Hi Sasank - from branding systems option, if you left Fluid Components default stylesheet name blank, it defaults to PSSTYLEDEF_FMODE. Can I use customized PSSTYLEDEF_FMODE (say PSSTYLEDEF_FMODE_CUSTOM) and populate it on the fly? I have multiple of that PSSTYLEDEF_FMODE_CUSTOM and would like to use depending on user attributes. I was able to locate that code that is using PSSTYLEDEF_FMODE if set up is blank but unable to override even forcing to use PSSTYLEDEF_FMODE_CUSTOM is not working.

    ReplyDelete
    Replies
    1. @alex_19081 - The best practice is to override styles using the Theme definition.

      I am not aware of a way to update the Branding System Options configuration dynamically. You could look into PTBR_BRANDING (or run a trace) and find the code references and use your own logic if required. But this will be a customization. Before you go down that option, I would suggest that you look into options of overriding CSS using the Theme Definition and dynamically assign them to user attributes.

      Delete
    2. Thank you Sasank for the very quick response.
      I'm thinking this code below when saving branding system option is the reason why i cannot override PSSTYLEDEF_FMODE. Eventhough i was able to override the css via code but it is not sync with the webserver.

      /* refresh the PSOPTIONS values in the appservers */
      &temp = UpdateSysVersion();

      Delete