Ability to view document prior to submitting it

Certified Senior Developer

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

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    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

  • 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

  • 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
      )
      }
    )

  • 0
    Certified Senior Developer
    in reply to Soma

    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!

  • Yes you can do that in Appian with a!submitUploadedFiles().

    FYI, a!submitUploadedFiles() is specifically disabled in User Input Tasks and Start Forms.  The approach you list here would work if the document upload is done on a Record or Site (though these areas are not usually recommended for this), but not in a regular process form of any type.

  • 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