How can I save an uploaded file into a Data Model ?

Hi there,I need your kind support plz !

In my app, there is a Record Type as below:

I want to use it to store the documents which are uploaded from a!fileUploadField item in an interface.

The introduction of a!save() in Documentation of Appian didn't mention the way to save a document type, can I get the directon here?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi   
    the function  a!documentFolderForRecordType() works when you have Record type to manage documents in your application. Also this function returns the folder where the document should be stored and thus should be used in the 'target' attribute of the file upload component which is missing in your code currently.

    There are 2 ways to Manage documents in Appian

    1. Using Record types

    2. Using folders

    Using Record types you will need a separate record type which has document and record id columns to store the document. You can find a detailed documentation and steps herea!documentFolderForRecordType() works for this management option and not when you use folders.

    Using folders, we create a folder within the Knowledge center of application where we want to documents to be stored when a user uploads it in interface. 

    Here is a working example to store documents using folders. Here is a tutorial to follow to learn about working with documents and records using folders

    a!localVariables(
      local!file,
      local!submissionSuccessful,
      local!errorCode,
      {
        a!fileUploadField(
          label: "File Upload",
          labelPosition: "ABOVE",
          saveInto: local!file,
          value: local!file,
          /* Replace this with a constant of type Folder in your environment */
          target: cons!AS_DOCUMENTS_FOLDER_POINTER
        ),
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Submit",
              style: "SOLID",
              /* If you don't use a!submitUploadedFiles(), the signature will not be uploaded */
              saveInto: a!submitUploadedFiles(
                onSuccess: a!save(local!submissionSuccessful, true),
                onError: {
                  a!save(local!submissionSuccessful, false),
                  a!save(local!errorCode, fv!error)
                }
              )
            )
          },
          align: "END"
        )
      }
    )
    

    So identify the way you want to establish document management then implement accordingly. Feel free to ask if you encounter any challenges. 

Reply
  • 0
    Certified Lead Developer

    Hi   
    the function  a!documentFolderForRecordType() works when you have Record type to manage documents in your application. Also this function returns the folder where the document should be stored and thus should be used in the 'target' attribute of the file upload component which is missing in your code currently.

    There are 2 ways to Manage documents in Appian

    1. Using Record types

    2. Using folders

    Using Record types you will need a separate record type which has document and record id columns to store the document. You can find a detailed documentation and steps herea!documentFolderForRecordType() works for this management option and not when you use folders.

    Using folders, we create a folder within the Knowledge center of application where we want to documents to be stored when a user uploads it in interface. 

    Here is a working example to store documents using folders. Here is a tutorial to follow to learn about working with documents and records using folders

    a!localVariables(
      local!file,
      local!submissionSuccessful,
      local!errorCode,
      {
        a!fileUploadField(
          label: "File Upload",
          labelPosition: "ABOVE",
          saveInto: local!file,
          value: local!file,
          /* Replace this with a constant of type Folder in your environment */
          target: cons!AS_DOCUMENTS_FOLDER_POINTER
        ),
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Submit",
              style: "SOLID",
              /* If you don't use a!submitUploadedFiles(), the signature will not be uploaded */
              saveInto: a!submitUploadedFiles(
                onSuccess: a!save(local!submissionSuccessful, true),
                onError: {
                  a!save(local!submissionSuccessful, false),
                  a!save(local!errorCode, fv!error)
                }
              )
            )
          },
          align: "END"
        )
      }
    )
    

    So identify the way you want to establish document management then implement accordingly. Feel free to ask if you encounter any challenges. 

Children
No Data