Skip to main content
September 27, 2024
Question

Ability to view document prior to submitting it

  • September 27, 2024
  • 6 replies
  • 0 views

Hi All,

Currently I have an interface where we allow the user to upload documents, we wanted to see if it was possible after the user clicks upload they can see the actual document before the submit the form, that way they "make sure" it is the correct document. Is this possible in appian at all?

thanks in advance

6 replies

September 27, 2024

Yes, you can utilize the a!documentViewerField component to display the document the user just uploaded

Read more here: docs.appian.com/.../Document_Viewer_Component.html

mikes0011
Brainy
September 30, 2024

Note this will NOT work for a freshly-uploaded document on a User Input Task which the user has not yet submitted.  The designer would, at the very least, need to require the user to submit the form (to get the document moved into the accessible internal filesystem), then loop back to (a new copy of) the same task, in which the document can be displayed.

you can utilize the a!documentViewerField component to display the document the user just uploaded
kumara0180
September 27, 2024

Yes you can, pass the parameter which is being used to save the document details to view the doc.

few things to keep in mind. You shall be able to view only one doc at a time. Or you need to loop through docs to view them on screen

somasundaram.d
September 28, 2024

Yes you can do that in Appian with a!submitUploadedFiles(). If you pass the documentId to documentViewerField directly, it will not render the document.

a!localVariables(
  local!document,
  local!showPreview: false,
  {
    a!fileUploadField(
    target: FOLDER
    value: local!document,
    saveInto: local!document
  ),
  a!richTextDisplayField(
    showWhen: a!isNotNullOrEmpty(local!document),
    value: a!richTextItem(
      text: "Preview Document",
      link: a!dynamicLink(
        saveInto: a!submitUploadedFiles(
          onSuccess: a!save(
            local!showPreview,
            true
          )
        )
      )
    )
  ),
  a!documentViewerField(
    height: "TALL",
    showWhen: local!showPreview = true,
    document: local!document
  )
  }
)

September 30, 2024

Thanks for sharing this, let me ask how could I do If in the current interface I'm allowing the user to upload multiple documents one after the other.

I'm using a grid to allow the user to add multiple, basically every row of the grid can be a new uploaded document.

Because what I'm seeing is that the viewer component is not available to be used in the grid, is this correct? 

a!fileUploadField(
                  label: "Attach Document(s)" & fv!index,
                  target: cons!DOCUMENTS,
                  maxSelections: 1,
                  value: fv!item.document,
                  saveInto: {
                    fv!item.Document,
                    a!save(
                      ri!Document,
                      a!forEach(
                        items: local!documents,
                        expression: {
                          documenttypekey: fv!item.documenttypekey,
                          title: fv!item.title,
                          document: fv!item.document,
                          uploadedby: fv!item.uploadedby,
                          uploadeddate: fv!item.uploadeddate,
                         
                         
                        }
                      )
                    ),
                    
                  },
                  required: true(),
                  buttonStyle: "STANDARD"
                )

thanks in advance!