Multiple File Upload

How can we make the File upload component as dynamic ? I have a rule input which has the type has a record type , so i cant select the multiple array option it it. The document id should be stored in the DB and the files should be saved in a Target folder.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You need to implement a separate record to hold the documents and define a one-many relationship from the original record to the new document record.

  • I have been told -

    You need to insert one row for each document you want to upload 

    e.g  if you are uploading the 3 doc in single file upload then you will insert 3 differnt row in database 

    1 row per each document .

    How can I achieve this?

  • 0
    Certified Lead Developer
    in reply to SM

    I assume you are talking about some interface code.

    The following code snippet works for me. You will have to adapt it to your scenario.

    {
      a!fileUploadField(
        label: "File Upload",
        labelPosition: "ABOVE",
        value: index(ri!documents, 'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document.fields.{e4de7e9c-c508-46bf-8469-7ef29ce17201}document', null),
        saveInto: a!save(
          target: ri!documents,
          value: a!forEach(
            items: save!value,
            expression: 'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document'(
              'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document.fields.{e4de7e9c-c508-46bf-8469-7ef29ce17201}document': fv!item
            )
          )
        ),
        validations: {}
      )
    }

Reply
  • 0
    Certified Lead Developer
    in reply to SM

    I assume you are talking about some interface code.

    The following code snippet works for me. You will have to adapt it to your scenario.

    {
      a!fileUploadField(
        label: "File Upload",
        labelPosition: "ABOVE",
        value: index(ri!documents, 'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document.fields.{e4de7e9c-c508-46bf-8469-7ef29ce17201}document', null),
        saveInto: a!save(
          target: ri!documents,
          value: a!forEach(
            items: save!value,
            expression: 'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document'(
              'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document.fields.{e4de7e9c-c508-46bf-8469-7ef29ce17201}document': fv!item
            )
          )
        ),
        validations: {}
      )
    }

Children
No Data