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

Parents
  • 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!

Reply
  • 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!

Children
No Data