Check document size after selecting document from uploader in a form sail

I have a form sail with a fileUploadField. When I select a file, I need to check the size and disable a button if is greather than 1MB.
The check is the following:
or(rule!APN_isBlank(save!value),document(save!value,"size")>1024000)

When a perform this check an error appear:

Interface Definition: Expression evaluation error: An error occurred while executing a save: Expression evaluation error at function 'document' [line 886]: Error evaluating function 'document' : Document Does Not Exist or has been Deleted

How can I resolve this problem?
Tanks

OriginalPostID-272088

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    @emanueld874: I highly suggest using a custom expression rule such as the one I posted above to return the size property. As @jaisym posted above, the in-task rendering in 17.1 has changed such that it doesn't work the same way anymore - and since this is not an officially supported method, it's liable to change at any time without notice, meaning if you have it hardcoded into a form then they'd all break and all need to be manually updated (whereas if it's all in one expression rule, that rule could be updated to use the new logic).
Reply
  • 0
    Certified Lead Developer
    @emanueld874: I highly suggest using a custom expression rule such as the one I posted above to return the size property. As @jaisym posted above, the in-task rendering in 17.1 has changed such that it doesn't work the same way anymore - and since this is not an officially supported method, it's liable to change at any time without notice, meaning if you have it hardcoded into a form then they'd all break and all need to be manually updated (whereas if it's all in one expression rule, that rule could be updated to use the new logic).
Children
No Data