fileUploadField() returns 403 Error when upload too many documents

Certified Associate Developer

Hi every one, 

I'm receiving above error when using fileUploadField() to upload around more than 150 documents. I checked and each document I uploaded has size around 322.74 KB only.

Within my fileUploadField() below is the code: 

a!fileUploadField(
                          maxSelections: 250,
                          label: "Upload Document",
                          labelPosition: "COLLAPSED",
                          value: ri!documents,
                          saveInto: {
                            ri!documents,
                            /*Save document details */
                              a!submitUploadedFiles(documents: ri!documents),
                            a!save(
                              ri!uploadedDocuments,
                              reject(
                                fn!isnull(_),
                                a!forEach(
                                  items: save!value,
                                  expression: if(
                                    contains(
                                      tointeger(
                                        index(
                                          ri!uploadedDocuments,
                                          "appianDocumentId",
                                          null
                                        )
                                      ),
                                      tointeger(fv!item)
                                    ),
                                    displayvalue(
                                      fv!item,
                                      tointeger(
                                        index(
                                          ri!uploadedDocuments,
                                          "appianDocumentId",
                                          null
                                        )
                                      ),
                                      ri!uploadedDocuments,
                                      null
                                    ),
                                      a!map(
                                        appianDocumentId: tointeger(fv!item),
                                         /* Query to DB to search for the document type Id using document name, return null if there is no matching query output */ 
                                        documentTypeId: index(rule!PRO_RULE_GetDetailsFromTaxDocumentName(documentName: rule!GBL_RULE_getDocumentContentName(documentId: tointeger(fv!item))), "documentTypeId"),
                                        entityTypeId: cons!NWL_INT_ENTITY_TYPE_ID_ASSET,
                                        /* Query to DB to search for the entity ID using document name, return null if there is no matching query output */ 
                                        entityId: index(rule!PRO_RULE_GetDetailsFromTaxDocumentName(documentName: rule!GBL_RULE_getDocumentContentName(documentId: tointeger(fv!item))), "entityId", null))
                                  )
                                )
                              )
                            ),
                            a!save(
                              local!docCategories,
                              reject(
                                fn!isnull(_),
                                a!forEach(
                                  items: save!value,
                                  expression: if(
                                    contains(
                                      tointeger(
                                        index(
                                          local!docCategories,
                                          "appianDocumentId",
                                          null
                                        )
                                      ),
                                      tointeger(fv!item)
                                    ),
                                    displayvalue(
                                      tointeger(fv!item),
                                      tointeger(
                                        index(
                                          local!docCategories,
                                          "appianDocumentId",
                                          null
                                        )
                                      ),
                                      local!docCategories,
                                      null
                                    ),
                                    a!map(
                                      appianDocumentId: tointeger(fv!item),
                                      categoryId: null
                                    )
                                  )
                                )
                              )
                            ),
                            a!save(ri!docCategories, local!docCategories),
                            /*Save filename */
                            if(
                              rule!AAA_CMN_IsEmpty(ri!documents),
                              {},
                              a!forEach(
                                items: ri!documents,
                                expression: a!save(
                                  ri!uploadedDocuments[fv!index].name,
                                  rule!GBL_RULE_getDocumentContentName(documentId: fv!item),

                                )
                              )
                            ),
                          },
                          target: cons!FOLDER_CASE_DOCUMENTS
                        )

Is there any limitation of this function except for file size limit is 1GB that I should be awared of? Or could you suggest me how can I debug this issue?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    At a glance a lot of manipulations are happening in the saveinto here. Can you try to optimise it if possible. Like moving few save options from the fileupload component to button component if possible!

    For better user experience it is suggested to have a!submitUploadedFiles() in a button widget. As users are uploading documents one after another system needs to submit the docs as well as execute each foreach() for each of 150 docs multiple times! Its not a good design. So just have files uploaded in the file upload component and move rest of the logic in a button widget. Those foreach are causing your system to execute the codes compoundingly and failing to load ultimately!

  • 0
    Certified Associate Developer
    in reply to Harsha Sharma

    Thanks Harsha, your solution worked like a charm! 

Reply Children