Prevent Removal of Uploaded Document

Hello, I have a use case in which I need to allow a user to upload multiple documents to a SAIL form via a!fileUploadField. Once the desired docs are uploaded, the user clicks a button to commit the documents to the form and sets a Boolean variable that's used to disable the file upload field. I need to prevent the user from adding more documents AND prevent them from removing committed docs once the button is clicked.

I have accomplished the ability to disable the file upload field, preventing additional uploads however the user can still remove uploaded documents from the interface via the X next to the document name. Is there a way to disable all functionality on a file upload field, including the ability to remove docs?

Thanks in advance for your help!

OriginalPostID-247982



  Discussion posts and replies are publicly visible

  • @jerimiaht
    Hi
    In case you havent had a chance please check the following entry

    forum.appian.com/.../e-200743

    It might be of help

    Thanks
  • @shashank The link you have mentioned was talking about preventing removal of the docs which were uploaded in the previous steps. Which can be achieved by using a!documentDownloadLink() component. After watching picture in the above comments, what i understand is the current user is uploading multiple files and once he click on File upload complete button he should not be able to remove the files.
  • In the file upload component once the user clicks on browse button and selects a file, when the file is uploaded i.e it will have a temporary Id for the uploaded doc. The user can still remove the file after clicking to X displayed next to file uploaded.I think this is the default behaviour as the user didn't submitted the form. if the user submits the form the file will be uploaded to the target KC. Please check your code what u are configured for the file upload complete button. I will suggest to go ahead like this.
    Make the File Upload complete button as submit button, and loop back to the same form, when it loop back to the same form display the file upload component as read only.
  • @jerimiah - As far as I understand from the requirements, A User will upload as many documents and once he clicks on "File Upload Complete", the user should not be able to remove the documents uploaded previously. To achieve the above requirement, there are 2 ways of doing it.

    1.\tMake the "File Upload Complete" button as buttonWidgetSubmit and submit the form and reload. While reloading, (consider ri!uploadedFiles is the list of file uploads), append all values in ri!files to ri!uploadedFiles and check if ri!uploadedFiles is not-empty. If true, then display all the filenames in a textField(with size) with no labels, iterated through a!applyComponents. By this way, the End User will not see the remove link. If you follow the same procedure of creating a Multi-file upload component as mentioned in,

    https://forum.appian.com/suite/help/7.11/SAIL_Recipes.html#Add_Multiple_File_Upload_Components_Dynamically

    Then, update the rule!ucMultiFileUploadRenderField() with:

    =with(
    local!paddedArray: append(ri!files, null),
    {
    if(not(rule!APN_isEmpty(ri!uploadedFiles)),
    a!textField(
    labelPosition: "ADJACENT",
    readOnly: true,
    value: concat(document(ri!uploadedFiles,"name"),".",document(ri!uploadedFiles,"extension"),"(",document(ri!uploadedFiles,"size"),"KB)")
    ),
    a!fileUploadField(
    label: if(ri!index = 1, ri!label, ""),
    target: ri!target,
    value: local!paddedArray[ri!index],
    saveInto: {
    a!save(ri!files, ucMultiFileUploadResizeArray(ri!files, ri!index, save!value))
    }
    ))
    }
    )
    2. You can follow same methodology, and replace the a!textField with a!documentDownloadLink.

    Please lemme know if this suffice!
  • Thanks very much for your feedback everyone, I really appreciate it! I really wanted to avoid going the button widget submit route for the "File Upload Complete" button. Since there wasn't a way to disable document removal out of the box, I convinced the business that disabling document removal was "bad process". I implemented a work around "solution" where I changed the "File Upload Complete" button to "Update/Refresh Uploaded Docs" and displaying the uploaded doc count in a rich text field adjacent to the file upload field.