File upload field uploading document even on cancel scenario

Hi All,

We have a requirement to upload a document which creates a new version of the existing document upon click of 'Submit' button and do not create upon click of 'Cancel button' (both buttons will submit the form).

Currently, Submitting the form (either through submit/cancel buttons) is creating a new version even though I am saving null value to uploaded files input upon click of 'Cancel' button.

I could see the below in appian documentation.

  • When implementing form cancel behavior via a submission, remember that the uploaded files are moved to the target on submission. If this is undesirable in a cancel scenario, it should be deleted (if target is a folder) or reverted via a new version (if the target is a document) by the process after submission.

but how can we revert the document to the previous version? Is there any function to delete the current version of a document or get a particular version of a document?

(even the Create new version smart service is deprecated)

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer
    I've used temporary folders for documents and folders for this express purpose. After submission, I move it to the appropriate location. Upon cancellation I delete the file.
  • Thanks for replay, this approch will not work for this scenarion why because in my case i am uploadint document as new version i.e,target is document, i can't remove the latest version of document as their is no functionality in appian.
  • 0
    Certified Associate Developer
    in reply to venkateshamu
    I suggest that instead of relying on Appian document versioning, you create new documents and remove the old ones instead. If you need to be able to "revert" back to previous versions of the documents, you keep previous versions.
  • 0
    Certified Lead Developer
    I agree with and i also accept that, there are some scenarios where you want to work with multiple versions of the document, so if that's deleted, may cause an issue.

    And as per my understanding, you are also having the similar kind of functionality, where the document will be uploaded as new version, so that you will have repository of each and every changes on a particular document.

    So the solution i feel is, you can create a table which will store document id's with some relation with user and document type, now while uploading the document, try uploading it as an another document instead of creating as an another version, and store this document id against the same user and document type where the version will be (totalCount of document where condition will be: uploaded by a user && type of document +1), so in this way, you will have multiple documents available with you and whenever you want, can fetch document Id of any version of this document.

    I understand that, if you point a document in fileUploadField, it will create a new version, but you may get an issue when you want to retrieve or delete a particular version of the document.

    I think, you should have these R&D, it may satisfy your requirement
  • @nathan.schmitz @aloks176, Thanks for the suggestion, we are already handling this issue as sameway that you are mentioned.
    I am hoping that appian will provide some functionality to handle this situation in feature releases.
  • 0
    Certified Lead Developer
    in reply to venkateshamu
    Along with the other prior commentors, our system also handles document versioning via a custom-built system (moving it around different target folders, with designated folders for "current versions", "old versions" and "deleted versions".

    This handles frustrations like you mention, as well as the fact that Appian versioning doesn't allow for a new version to be created with a document of a different extension (so users would try to replace a ".doc" with a ".docx" and not understand why they couldn't - partly because Windows still stupidly hides extenions by default, even though it's now 2017 and not 1997...)

    However i'm dismayed to hear that not even nulling-out the uploaded document when "cancel" is clicked woult prevent the existing version from being overwritten. This does seem like a gap in functionality.
  • Hi, I was also facing the same issue. But if user deselect the file from file upload field at that time it won't upload it . So I tried to force the user to remove the file from the file upload field to cancel . For that purpose I used disable functionality of cancel button.