I have a requirement, where on UI Pages , have to show section from a data type containing columns such as category, description etc. On section I have Provided Add Action which can add new row to datatype(done using savable datapage).Now requirement is user should be able to add attachments as well.
How we can add attachments in Data instance only without WorkObject??Also how to upload files in UI Pages.
@varnikag To add attachments in a data class section in UI Pages without creating a Work Object you can follow these steps: 1. Use FilePath Control: Utilize the filePath control to upload the file. This control allows users to select and upload files directly from the UI. 2. Create Data WorkAttachFile Instance: After uploading the file create an instance of Data WorkAttachFile to store the attachment details. 3. Link Objects Method: Use the Link Objects method to create a link instance between the data class and the attachment. This method helps in associating the uploaded file with the data instance. 4. Refer to Work AttachFile Activity: For implementation details you can refer to the Work AttachFile activity which provides a comprehensive guide on handling file attachments. By following these steps you can successfully add attachments to a data instance without creating a Work Object. For uploading files in UI Pages you can use the pzDragDocument section to upload files. This section forms a page list dragDropFileUpload in the current thread of class Embed DragDropFile which contains information about the uploaded file such as File Name File Stream and Attachment Type. You can then copy the results to a custom page list property and handle the attachments accordingly.
This is a GenAI-powered tool. All generated answers require validation against the provided references.
@MarijeSchillern thanks for reply. To resolve above challenge, We used pyUploadFileWithBrowseOption as local action which is in Data- Class.However, another issue I encountered was ,In Clipboard I could see file Name in pyFileNameHolder , but we cannot use this property as it was saying invalid property .It seems this property exist in Data-NLP class instead of baseclass. Hence, there was no way to use this property.
Pegasystems, suggested one workaround “The fix was a local change to save the OOTB UploadFile activity to a custom ruleset and change the property name from ‘pyFileNameHolder’ to a custom property name created in Data- class. After making this change the uploaded file name is being set for the custom property and it is available for the activity to retrieve the uploaded file name.”
I implemented this along with saving as the flow action pyUploadFileWithBrowseOption and section UploadFileWithBrowseOption. Now the attachments are working in the Data instance only.
@PegaSystems Should give a permanent fix for this and make the pyFileNameHolder in baseclass for use. This issue was 4 years back with SR-D46394, in one of the articles I found it https://support.pega.com/question/file-name-uploaded-file,but still no fix is there in latest versions.