Making Objects Accessible in the Branding Framework

The Branding Framework pages are really useful because they provide the ability to add and update branding-related objects from within the PIA. These pages provide a convenient alternative to having to open up App Designer to make simple changes to HTML, JavaScript, Images, or Style Sheets. One limitation that I have found with the Branding Framework is that you cannot use it to modify objects that were not created with the framework. For example, if I want to make a change to the PT_COMMON HTML definition, then I would I have to make this change in App Designer. It turns out that there is a delivered PeopleCode library that allows us to manage the Branding Framework objects. I would like to demonstrate how this library can be used to add an existing object to the Branding Framework so that the object can be modified from the PIA.

I will start off by creating a new HTML definition in App Designer.

New_Object

As I mentioned above, I cannot simply go to the Branding Objects page (PeopleTools > Portal > Branding > Branding Objects) in the PIA to modify the contents of this object. When I go to the Branding Objects page at this point, I am presented with no modifiable objects.

Branding_Objects

I made a simple page to get the newly created object imported into the Branding Framework. The page has an input field and a button.

Test_Page

This page will take an HTML object name in the input field and upload the object to the Branding Framework on the button click.

Input_Value

When the user inputs the HTML object name into the input field and clicks the OK button, a small piece of PeopleCode fires.

Save_Object

import PTBR_BRANDING:BrandingObj;

/* Populate the user inputted object name */
Local string &sHTMLObjName = PSM_WRK0.CONTNAME.Value;

/* Reference the BrandingObj class */
Local PTBR_BRANDING:BrandingObj &objBranding;
&objBranding = create PTBR_BRANDING:BrandingObj();

/* Call the new method with the object name, object type (H-HTML,I-Image,J-JavaScript,S-Style), user ID, and date */
&objBranding.new(&sHTMLObjName, "J", %UserId, %Datetime);

/* Call the save method to save the object to the Branding Framework */
If (&objBranding.save()) Then
 MessageBox(0, "", 0, 0, "Saved");
Else
 MessageBox(0, "", 0, 0, "Save Failed");
End-If;

This PeopleCode uses the BrandingObj class of the PTBR_BRANDING application package to import the HTML object definition as a JavaScript object in the Branding Framework. The BrandingObj class can be used in the same fashion for uploading other object types such as images or style sheets into the Branding Framework.

Now when I go back to the Branding Objects page in the PIA, I can see my newly imported JavaScript object.

New_Branding_Object

I am no longer bound to only being able to update this object’s content in App Designer.  I can now modify this object from within the PIA.

Comments

Sasank Vemana

Hey Colton - Great post again! Very handy. This has been a pain to workaround at times.

I believe this issue occurs with migration as well. That is, if you migrate an object that you added from the PIA, it will not be available in the target PIA for some reason. Here is how I was working around that problem. https://pe0ples0ft.blogspot.com/2015/04/peopletools-854-branding-objects.html

Colton Fischer

Hey Sasank! Thanks for sharing the related article. Hopefully we will see some improvements to the Branding Framework in the 8.56 Tools that will make managing these objects a bit easier.
It’d be really be nice to see them incorporate an enhanced PIA JavaScript editor like the one you demoed at Alliance. That was a very interesting solution that you came up with.

Leave a comment

Your email address will not be published. Required fields are marked *

Loading...