Search This Blog

Monday, October 31, 2011

Add Attachment

Uploading files through Add button at level0 and showing the uploaded files onto a grid.
Main records:
Transaction Record at Level 0 : PS_REC_TRANS.
Transaction Record at Level 1: PS_REC_UPLD
Derived Work Record: FILE_ATTACH_WRK or custom record which is clone of the FILE_ATTACH_WRK

Details:
-->Suppose that we have a transaction record PS_REC_TRANS and TRANS_KEY is a Key.
-->Since we are showing uploaded files in the grid, the level1 record (PS_REC_UPLD) should have 2 keys (TRANS_KEY and ATTACHSYSUSERFILE).
-->Now we need to have a derived work record that holds the buttons 'Add Attachment/Delete Attachment/View Attachment'.
There is a delivered record (FILE_ATTACH_WRK) but PeopleSoft recommends to use own custom record which is a copy of delivered record. This recommendation is made so that in future if any changes are done it should not impact the current functionality.

Designing the page:
Add PS_REC_TRANS at level0.
Drag and drop the AddAttachment button onto the page. (level 0).
Optional: Mostly we would like to see the uploaded file next to AddAttachmet button. To accomplish this create a derived work record that holds the ATTACHUSERFILE field.
Insert grid.
Drag and drop the record PS_REC_UPLD onto the grid.
Also include the buttons Delete Attachment and View Attachment onto the grid.
Save the Page.
We need to add peopleocode to the buttons to implement the attachment functionality.
Better if we use Component record field peoplecode, as it will not impact any other comoponent.
Now consider the 'Add Attachment ' Button. Once the user clicks on this button file should be uploaded to the server and then after successful upload filename should appear in the level1 grid.
To make this happen, Declare the function Add_attachment and then call the function. There will be a status field present in the function which will let us know the attachment if failure / success.
Call the level1 rowset and insert the file data. Make sure that DoSave() method to be called.
I will be providing the code in the next post.

1 comment:

manusha cimbili said...

Hi siva.Information that you have provided is useful to me.I want to upload the file which is present in level 1 .So can you please send the code how to cal the attachment which is present in level 1.My mail Id: manusha.cimbili@gmail.com
Thanking you.
Manusha