Thursday, October 6th, 2011

Attachment Framework – An Example

The Attachment Framework is available within PeopleSoft for use with several vanilla parts. However, users usually want more places where attachments can be added to functionality. At this point technical people can be glad Application Packages are implemented into PeopleSoft these days, and moreover, that Oracle put the Attachment Framework into these objects.

As an example the usage of personal dossiers can be brought up. A breakdown of functional areas where all relevant documents of an employee can be placed in. Accessible for the employee and in some cases maybe for their manager or team secretary. In order to get something like this going I would need a record where the documents can be stored, a page where users can use this functionality and the Attachment Framework packages. A lot more functionality can be thought of to incorporate into something like this, but the basics are just this.

So where to start? Let’s start with what Oracle gave us, the objects to make use of the actual framework. The first object is the package that deals with most of the work for you, the Application Package HR_ATTACHMENTS. Within this package there are two classes that I’ll use;

As the names assume, Attachment_Data is used to process the data and Attachment_UI is used to serve all the delivered pages during the attachment process, whether this is adding, modifying or deleting. Yes you read it right, the package serves the much needed pages to interact with the classes for you. Same goes for the placement of the attachments, PeopleSoft has a record that stores the attachment files with the name HR_ATT_FILES_DD. For this record to be filled you only need to make one record where the subrecord HR_ATT_DD_SBR in it. This will act as the placeholder for the references to the actual files that get attached through your page.

With the record ready to be used you would need a page to show a list of the attachments and buttons to have an opening to the UI part of the Application Package. A simple page could look like this:

A breakdown of this page:

  • Employee ID and name at the top
  • Button to add or edit attachments
  • Grid to show the attachments with two options; a button for attachments/URL’s and a button for notes

The grid is populated by the record I needed to create with the subrecord HR_ATT_DD_SBR in it. In this case it’s kept simple:

The field EMPLID is added as a key and that’s all I need. Add the mentioned subrecord and build it as a normal SQL Table. For the buttons a standard Derived record is used with three fields.

Then for the fun part, incorporating the Attachment Framework to a single page and instantly getting a fully functional part of PeopleSoft.

First off the setup needs to be done. As with many parts of HRMS these days, the Attachment Framework has a number of setup pages to configure the framework as you go. Follow the next steps for an example setup:

Set Up HRMS > Common Definitions > Attachments > Define Authorization

On this first page you can setup an authorization ID where you can define which types of attachments you wish to allow and how the attachments should be deleted, permanently or fictively. In this example I’ve allowed for all attachment types and actions. Also when an attachment is deleted by a user, it only fictively deletes it, keeping the actual file in the database.

 

Set Up HRMS > Common Definitions > Attachments > Define Authorization Entries

On the next page the authorization ID can be linked to one or more roles that should get access to your part of the Attachment Framework. In this example all employees can use our attachment functionality.

Set Up HRMS > Common Definitions > Attachments > Define Attachments

The third setup page allows you to define the type of attachments you want to use. There are three types of attachment: Attachment, URL and Document Definition. The first two allow you to put in a document or URL in this setup page, thus delivering a standard document or link to its users. Only the Document Definition can be edited by users, in other words, let them attach actual documents, notes or URL’s. Finally you need to link this attachment definition to one or more authorization ID’s.

Do this step for each category that you want to use in your application.

 

Set Up HRMS > Common Definitions > Attachments > Configure Keys

With the next page I’m almost there with regards to setup. The object owner ID is a predefined set of functional area’s that you can choose. The sub ID is the same. In this case I thought it was wise to pick Human Resources and Attachments.

With filling these fields it’s not quite done yet. There are two links at the end that need to be used as well.

The first one is where you can fill in the context keys regarding your part of the Attachment Framework. In other words, which data needs to be validated in order to make sure you can place the actual attachments to for example the right person or group.

The next link is the place where you can define in which table the data needs to be stored and which keys it has. Here I can fill in our freshly made table from the beginning of this article.

 

Set Up HRMS > Common Definitions > Attachments > Maintain Definitions

The final page links the context keys together with the attachment definitions and the sequence you might want to show them in.

After finishing the setup I can go on with the next step, implementing the Application Framework application packages into our page.

The first step is to be able to see all the attachments of a particular group in your grid area. In this example I placed the code on the page activate event. Make sure you import the HR_ATTACHMENTS package.

Application Package
HR_ATTACHMENTS
 
Used methods
HR_ATTACHMENTS:Attachment_Data:GetAttachmentLinks

On the example page there is also a button that should allow you to add, edit and delete attachments. This was done with the following parts:

Application Package
HR_ATTACHMENTS
 
Used methods
HR_ATTACHMENTS:Attachment_UI:OpenAttachment

When used right, this should result into the following page:

Last thing to do is make sure the attachments can be opened through the example page. For this to work a paperclip image was added for attachments and URL’s, and a notepad image was added for notes. The action behind these buttons are the same, they end up with opening either a document or an URL.

Used functions
view_attachment from FILE_ATTACH_WRK.ATTACHVIEW
ViewContentURL

Now I can almost hear you say “Why not use the Application Package to open the attachments?”. Yes you can, and even more so, you should! Funny thing is though, that the method OpenAttachment does exactly the same for URL’s and Attachments. Yet I wanted to experiment with showing notes in another way than the framework does. Well, actually, in a way the framework doesn’t do it. Because when you look at the method OpenAttachment, it doesn’t have code to open notes. The overall page for your attachments provided by Oracle does a transfer to another page in the component where the information is shown in a simple layout. I wanted to experiment with showing the notes directly on the example page like so:

This is a simple set of HTML layouts that are called when clicking the notepad image in a row. I’m sure you can think of several other ways of showing the information of a note.

There are several other ways of implementing the Application Framework into your own functionality. This is but a mere example to show it’s possibilities. Getting into the Application Package and seeing its full potential is the next step you should take yourself.

 Viewed 3479 times by 1140 visitors


Category: Technical
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response

March 10, 2012
avatar

Almost all of the important things on the planet are already accomplished by individuals who have continued trying when there was no hope at all.
Corporation: A nifty little device for obtaining profit without individual responsibility.

[Reply to this comment]