Support Article
Attachment FileSize is not Stored
SA-61141
Summary
FileSize and pyFileSize properties of the Data-WorkAttach-File class do not store the attachment size.
Error Messages
Not Applicable
Steps to Reproduce
Unknown
Root Cause
A defect in Pegasystems’ code or rules.
Resolution
Perform the following local-change:
The application is designed to have attachments in the work-objects adhere to the max-filesize-limit. The size of the uploaded attachment is in the scope of the design. To provide users an extension to store the file size, the properties pyFileSize in Data-WorkAttach-File is created. Following the below steps to store the file size:
- Create a Declare Trigger on the Data-WorkAttach-File class. This triggers when an instance is committed Save or Saved.
Note: Trigger when an instance can be changed as required. Same is the case with the Execute option for the Trigger activity.
- Configure a Trigger activity as a custom activity and execute the condition as required.
In the activity, perform a property-set on the .pyFileSize with calculation as below,
0.75 * @String.length(.pyAttachStream)/1024 (for KB).
Step 1 in the activity log the Purposes and is not required. The Calculation logic is for KB conversion. The same can be changed as required. - Save the activity as a Trigger from the Security tab.
Output:
For reference, an out-of-the-box declare trigger exists on the Data-WorkAttach-File class named pySaveContent.
Published April 6, 2019 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.