to open the attachments on click of the name of attachments
The requirement is to open an attachments from the list of attachment in the UI. On click of the name of the attachment, the attachment will be opened.
I can fetch the required columns in Grid layout in a section inluding the name of attachment from the "AttachFile.pxAttachName" column of out of the box Report Definition 'pyGetAllAttachments' of Class Link-Attachment. Is there a way to open the attachments on click of the name of attachments?
1) Create Grid layout
2) Source Report Definition: pyGetAllAttachments
3) Property Name in Grid: AttachFile.pxAttachName
4) Execute the section
5. List of attachment names will be displayed along with the file extension
Requirement: Click the attachment name and open the attachment
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
Thank you. I attempted to resolve this issue by using link control: Link Caption>Property Reference= AttachFile.pxAttachName. Then on Click Event, used Run Script with the function name ="pega.ui.HarnessActions.doAttachmentSingleClick", and parameter value as ".pxLinkedRefTo". However, it did not open the attachment. I got null pointer exception. Is there any other things I need to change?
In Pega when you add attachment it is normalised in three table.
First is work object table i.e. the work object to which you are attaching the attachment.
Second is attachment table i.e. the table which holds the actual attachment and
Third is Link-attachment table which holds the linking of particular work object and attachment.
When you refer the data page which shows link to all attachment it does not contain the attachment but it has the pzinskey of the attachment which is stored in the attachment table in pxLinkedRefTo property.
I would suggest following work around / solution to download the file.
1. On the link show the action fire an activity by choosing the event 'OpenURLINWIndow' . In activity create a new page 'File' of the class 'Data-WorkAttach-File' (Assuming your attachment is a File).
2. On this new page do obj open by handle and pass value of 'pxLinkedRefTo' value as the key.
3. After step 3 verify that '.pyAttachStream' and '.pxAttachName' properties are populated on the 'File' Page.
4. Call Java step in this activity and call Pega engine API "tools.sendFile(tools.findPage("File"),"pyAttachStream",true,"pxAttachName",null,true,null,true);"
Thank you for posting your query in the PSC. This looks like an inactive post and hence, we suggest you create a new post for your query. Click on the Write a Post button that’s available on the top right pane of this page. Once created, please reply back here with the URL of the new post.
You may also refer this discussion link as a reference in the new thread
We have also sent you a private message opening up a communication channel in case you have any further questions.