Documents upload and delete

Hi All,

I'm  new to Appian and have a requirement  where a user should upload multiple documents and delete any accidentally uploaded documents.

On submit, the process model would kick start where the documents details get stored in database. Also,we need to delete the documents if any.

After file upload , Need to get the link to download.

It would be helpful if I get any sample  code to refer.

Thanks....

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    I'm a little confused by what your requirement / desired process flow is here?

    a user should upload multiple documents

    (simple enough...)

    and delete any accidentally uploaded documents

    what/who is determining which document(s) are considered as "accidentally uploaded"?

    the process model would kick start where the documents details get stored in database.

    (this sounds fine also. should be straightforward to implement.)

    Also,we need to delete the documents

    Why would you delete the documents just after uploading?  Am I missing something?

    After file upload , Need to get the link to download.

    FYI there isn't really any "link" to get, really - all you need is the Appian Document ID for each uploaded document (which you get automatically after submitting the original form the document(s) were uploaded on), and a!documentDownloadLink() on an interface.  So just make sure your database row for a document includes its Appian Document ID.

  • So...it's a little unclear in places what you're asking for but I can try to cover all the bases...so:

    • in your interface you can use the https://docs.appian.com/suite/help/19.3/File_Upload_Component.html to upload files. This comes with the ability to remove the file within the same component BEFORE you submit the form to the process. That might address your requirement to remove documents accidentally uploaded, but only BEFORE you submit the form.
    • once the form has been submitted the document objects are now available to your application and you can, for example, render them in an interface and could run a deletion process from that point if you need to delete AFTER the original upload form has been submitted.
    • A typical pattern is that a database table is used to hold metadata about the document, including the document's objectId (as a 'pointer' to the document). You can then use this database table as the source for a user interface table, and then you can run deletion activity from this interface (again, there are a variety of patterns available to you)
    • Here's one recipe that might help you get started: https://docs.appian.com/suite/help/19.3/recipe-display-multiple-files-in-a-grid-for-editing.html (there are plenty of other examples you can draw upon to help you achieve your objectives)
  • Hi Mike,

    Thanks for clarifying.

    What if user upload an incorrect file and submit which gets stored in database. So he needs to upload the file again and delete the older document.

  • 0
    Certified Lead Developer
    in reply to srilakshmit

    If it's the user that decides an incorrect file was uploaded, that's fine (and a normal use case) -- you would then need to build in the capability in your interface for the user to "delete" the file (i suggest for record-keeping purposes, you not actually delete files except for ones used very temporarily, but instead, move them to a special designated location within Appian's folder structure for "deleted" files, and have a flag in the database table for each document to also indicate its "deleted" status). 

    The recipe Stewart posted in his earlier reply would only need a small addition to accomplish this - add an extra column at the end of the grid, and configure it to contain a "delete" link (either text, or icon, etc), which could then submit the form, mark that document as "deleted" in the database and move it to the "deleted" folder location (or actually delete it if you are required to), then loop back to the same form again.