I have requirement in which a user uploads a document while composing a comment. The uploaded document should be stored temporarily, and its ID held until the user submits the comment. If the comment is submitted, the document becomes permanent; otherwise, it should remain temporary.
Discussion posts and replies are publicly visible
This is the default behaviour of Appian.
Unless you save or submit your form, the document anyway is saved temporarily in the UI. So user can add comments or fill up other form fields, even update uploaded documents and documents will not become permanent!
Appian automatically handles this requirement through its default file upload behavior. When files are uploaded via a!fileUploadField, they're stored temporarily until form submission. Upon successful submission, Appian moves them to the permanent target folder, if the form is cancelled, temporary files are automatically deleted.No custom logic needed - just configure the target folder in your file upload field and Appian manages the temporary-to-permanent transition automatically.