HCM Fluid Attachment Framework Configuration


Building Something with the HCM Fluid Attachment Framework




What we are building
We want to build a fluid component in PeopleSoft that utilizes the HCM attachment framework.  We want this component to be accessible to certain users as an entry page, thus the need to display a logo instead of a back button.  This needs to setup with as little customization as possible.


Software Requirements
This exercise needs to be setup on HCM Image 25 or greater.



Challenge 1:


Configure the Fluid Branding Framework to show a logo instead of the back button:





Configuration Steps:

Via WINSCP:
Upload your svg logo file the following location to the portal.war directory on the Peoplesoft Server. The directories uc_content and images will need to be created.  If you use the peoplesoft login page, it may be likely that you have already placed an image in a similar location within the PORTAL.war directory.



Note: IE may position your SVG in the centre: you can open the SVG image with notepad, and make the following additions / changes:

<svg viewbox="0 0 64 64"
    preserveAspectRatio="xMinYMid"></svg>

Where the viewbox would be the ratio of your SVG.  The preserveAspectRatio property will ensure your SVG is left aligned in IE.

Theme Macro Set:
Via Ptools > Portal > Branding Theme Macro Set
Select PT_DEFAULT_MACROSET_855
Click Copy Macro Set
New Name: UC_PT_DEFAULT_GUEST_855



Within UC_PT_DEFAULT_GUEST_855 Theme Macro Set:
Change Attributes:
36 PT_BANNER_BACKGROUND_COLOR: red; background-repeat: no-repeat;
37 PT_BANNER_BACKGROUND_IMAGE:  url(/uc_content/images/UCImage.svg)
57 PT_BANNER_BORDER_COLOR: rgb(97, 33, 11)
75 PT_BANNER_BUTTON_TRUE_BG_COLOR_HOVER: rgb(221, 87, 4)
Notes ~ it would have been easier to use the database stored %Image on Item 37, but that doesn’t work ~ this is a slight hack to get around the no back button issue.  If this is to be migrated to other environments, uploading the image to the PORTAL.war directory will need to be done the target environment as well.


Assemble Themes:
Via Ptools > Portal > Branding > Assemble Themes
Load theme DEFAULT_THEME_FLUID
Click Save As Button:
Use name: UC_THEME_FLUID_GUEST
Set the following Attributes:



Create Role Security:
Via Ptools > Security > PLs and Roles > Roles
Add a new role called UC_PUBLIC (use for the scope of this project)
Assign it to an account that will access this component.

Assign Themes:
Via Via Ptools > Portal > Branding > Assign Themes



Challenge 2:

Using the HCM Attachment Framework on a Fluid Page.

Configuration Steps:

First, create and build the following Fields and Records in App Designer:



And Insert the following Data:
Insert into PS_UCUT_ODC_DTYPE values ('WKPERM');

Create new Field: UC_GUID: Length 36 Char
Create new record: UCPT_PUBFILE
Insert UC_GUID, and sub record: HR_ATT_DD_SBR to the record



In the Record Definition, set the Owner ID, the Description to Cust Record Storing Pub Objects
Build Record
These will importantly be used in Context and Store Keys in the following steps.


Next we have to step through the HCM attachment framework:
Via the PIA,
Create a new Authorization:



Create a new Authorization Entry:



Define Attachments:



Configure Keys:



Set Context Key: related to the table created previously



Set Store Key: related to the table created previously



Maintain Definitions:
Configure as below:



App Designer Work:
New Record:
UCPT_PUB_WRK - Derived / Work
Fields added to Record:
SAVE_PB
Add PeopleCode to Field in Record:
SAVE_PB.FieldChange
import HR_ATTACHMENT_FLU:Attachment_Fluid;
Component HR_ATTACHMENT_FLU:Attachment_Fluid &call_attachment;
/* Calling Save*/
&call_attachment.Attachment_SaveProcessing();

New > Page – Fluid > PSL_APPS_CONTENT
UC_S_FL
Insert Sub Page: HR_ATTCH_FL_SBF



Insert Push Button: associate with record created previously



Component:
UC_S_FL
Insert Page UC_S_FL
Component Properties
  






Add PeopleCode:

UC_S_FL.GBL PostBuild:
import HR_ATTACHMENT_FLU:Attachment_Fluid;
Local string &RandomGuid;
Component Rowset &Lvl1, &RS_DocDefns;
Component HR_ATTACHMENT_FLU:Attachment_Fluid &call_attachment;
/*Initialize parameters for calling attachment constructor*/
&CKeys = CreateArray("WKPERM"); /*This array would contain the Context key values*/
&RandomGuid = GetJavaClass("java.util.UUID").randomUUID().toString();
&Store_Keys_Array = CreateArray(&RandomGuid); /*This array would contain the Store key values*/
/*Initialize component rowsets*/
&Lvl1 = GetLevel0()(1).GetRowset(Scroll.HR_ATT_KEYS_S);
&RS_DocDefns = GetLevel0()(1).GetRowset(Scroll.HR_ATTACH_FLU);
/*Calling attachment constructor*/
&call_attachment = create HR_ATTACHMENT_FLU:Attachment_Fluid("UC", "PUB", "", %Date, &CKeys, %UserId, %Component, "", &Store_Keys_Array, False);

Add Menus:

Security Setup:
Via PIA
Add Permission List: UC_PUBLIC &  Assign to Role UC_PUBLIC.
Set Page access in Permission list:



Create a Content Reference for this too!! Very NB for it to work!!



If you do not have a content reference created, you will get this terrible error:



URL to Visit:
Visiting the URL as a user with UC_PUBLIC Role:



SQL:
This query shows where this is stored in the database:
select * from PS_UCPT_PUBFILE a join PS_HR_ATT_FILES_DD b on a.attachsysfilename = b.attachsysfilename;

Files that have been deleted appear as ‘D’ in the HR_ATT_TYPE column ~ where they’ll have to be cleaned up by the admin. (this setting is configurable on ‘Create New Authorization’ above).

Afterthoughts:

Obviously this creates data in your database, and steps should be taken to prevent any user from accessing this ~ and at certain intervals the data should be cleaned up.






1 comment: