Skip to main content
June 23, 2023
Question

Document Size Validation

  • June 23, 2023
  • 7 replies
  • 0 views

Hi All,

I have to provide document size validation in file upload field like if uploaded document is more than 10 MB,I will display the validation error.

I have two buttons Submit and Cancel ,and for each the submit parameter is set as true() .

For submit button the validate parameter is true() and for cancel button the validate parameter is false().

So ,when the user uploads more than 10MB,they not able to submit until they reduce the doc size and for Cancel we are not saving the document into Database.

But here I am facing the below issue,

When the user clicks on Cancel ,it not writes in Database as expected ,but it saves in the Appian folder, since it goes out of the node.

So please help me if there is any way to avoid saving this file in Appian folder if document size is more than 10MB.

Thanks in Advance!

    7 replies

    harshitb6843
    June 23, 2023

    Set the variable to null in your cancel button. The variable that you are using as saveInto of your file upload field. 

    June 23, 2023

    Hi Harshit, thanks for your response.SaveInto will be null since I am giving the doc size validation,but in target folder it get saved. Any way to handle this?

    harshitb6843
    June 23, 2023

    Then it shouldn't save. Anyway, you can delete the document in the process after checking the button action. Use delete document smart service. 

    mikes0011
    Brainy
    June 23, 2023
    if there is any way to avoid saving this file in Appian folder if document size is more than 10MB

    2 methods:

    1. Disable the CANCEL button if there's a new file uploaded - and provide a tooltip on the cancel button asking the user to clear out the upload field first.
    2. Leave the CANCEL button enabled; continue to save the uploaded document ID into the rule input it was targeted at previously, but in the CANCEL path process flow, add logic to check if there is a populated document ID, and if so, delete it.  I created a specialized system-wide utility subprocess called "Safe Delete", which checks whether the provided document ID is non-null (and actually exists) prior to trying the DELETE DOCUMENT node, as this node is NOT null-safe.
    The Expression Guru
    June 26, 2023

    Thank you Mike,2nd method works for me and it seems better than forcing the user to remove all uploaded documents even they are planning to Cancel the flow.

    mikes0011
    Brainy
    June 26, 2023

    I agree, depending on context.  I've used both before.  However there are some cases where, for example, a document is added to a row in an Editable Grid, where the grid rows themselves can be removed by a user, where i've taken special pains to come up with a method where the "remove row" control is disabled until the user removes the uploaded document on that row.

    The Expression Guru