FileSize and pyFileSize properties of the Data-WorkAttach-File class do not store the attachment size.
Steps to Reproduce
A defect in Pegasystems’ code or rules.
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.
For reference, an out-of-the-box declare trigger exists on the Data-WorkAttach-File class named pySaveContent.