Support Article

Attachment FileSize is not Stored



FileSize and pyFileSize properties of the Data-WorkAttach-File class do not store the attachment size.

Error Messages

Not Applicable

Steps to Reproduce


Root Cause

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:
  1. 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.
  2. 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.
  3. 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.


Published July 13, 2018 — Updated April 6, 2019

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.