document upload error - document does not exist or deletedlinkfilink

Scenario: When uploaded a document, expecting a linkfield to show the document to download.

Problem:

When Document is uploaded an error below is thrown. foreach code is below. Please advise what is the issue and how to fix it. Used document function to retrieve name of document as label for link field.

  

 

a!fileUploadField(
label: "Upload New Documents here",
labelPosition: "ABOVE",
helptooltip: "Upload any project related documents here or download any uploaded documents through the below links.",
value: ri!NSARequest.Forms.AdditionalDocuments,
saveInto: a!save(ri!NSARequest.Forms.AdditionalDocuments, append(ri!NSARequest.Forms.AdditionalDocuments, save!value)),
target: cons!NSA_Documents_Cons,
showWhen: ri!readonly = false,
validations: {}
),


a!linkField(
label: "Documents Uploaded",
links: {
a!documentDownloadLink(
label: ri!NSARequest.Forms.PartABForm.Name,
document: todocument(ri!NSARequest.Forms.PartABForm.DocumentId),
showWhen: not(isnull(ri!NSARequest.Forms.PartABForm.DocumentId))
),
a!documentDownloadLink(
label: ri!NSARequest.Forms.PartCForm.Name,
document: todocument(ri!NSARequest.Forms.PartCForm.DocumentId),
showWhen: not(isnull(ri!NSARequest.Forms.PartCForm.DocumentId))
),
a!documentDownloadLink(
label: ri!NSARequest.Forms.PartDForm.Name,
document: todocument(ri!NSARequest.Forms.PartDForm.DocumentId),
showWhen: not(isnull(ri!NSARequest.Forms.PartDForm.DocumentId))
),
a!forEach(
items: ri!NSARequest.Forms.AdditionalDocuments,
expression: a!documentDownloadLink(
label: document(tointeger(fv!item),"name"),
document: fv!item
)
)
},
showWhen: or(or(or(not(isnull(ri!NSARequest.Forms.PartABForm.DocumentId)), not(isnull(ri!NSARequest.Forms.PartCForm.DocumentId))), not(isnull(ri!NSARequest.Forms.PartDForm.DocumentId))), not(isnull(ri!NSARequest.Forms.AdditionalDocuments)))
)

  Discussion posts and replies are publicly visible

Parents
  • Hi anushas0002 ,

    As you are trying to display links for the documents that user uploads in the same form, this is not going to work. The way appian deals with document uploads is

    When a file is uploaded, the component updates with a temporary Document representing the uploaded file. Between the upload and the form submission, the file on the server is an inactive temporary file and not accessible except through fv! variables described in the File Name, File Description, and Validations parameters. This is the only way to access file metadata before the form is submitted.

Reply
  • Hi anushas0002 ,

    As you are trying to display links for the documents that user uploads in the same form, this is not going to work. The way appian deals with document uploads is

    When a file is uploaded, the component updates with a temporary Document representing the uploaded file. Between the upload and the form submission, the file on the server is an inactive temporary file and not accessible except through fv! variables described in the File Name, File Description, and Validations parameters. This is the only way to access file metadata before the form is submitted.

Children
No Data