Skip to main content
chrisg0006
December 20, 2024
Question

Uploaded Document Disappear

  • December 20, 2024
  • 23 replies
  • 0 views

When I upload my files, they disappear!!!

[View:/cfs-file/__key/communityserver-discussions-components-files/62/Uploaded-Files-Disappear.mp4:320:240]

Here is the code:

                    a!fileUploadField(
                        label: "Please upload any pictures, brochures or other documents describing the Project",
                        labelPosition: "ABOVE",
                        target: cons!PMSO_ApplicationDocuments,
                        value: ri!volunteerDocuments,
                        saveInto: ri!volunteerDocuments,
                        showWhen: if(
                          a!isNullOrEmpty(
                            local!applicationDocSubmissionSuccessful
                          ),
                          true,
                          not(
                            local!applicationDocSubmissionSuccessful
                          )
                        ),
                        validations: {}
                      ),

I checked to make sure that the accounts have Editor access to the folder and the Constant is pointing to the correct folder.

The Rule Input, volunteerDocuments never gets updated.

The funny thing is that this used to work.  I tested it many times, and now it doesn't work.  The only change to the system was the security patches that were installed.

23 replies

mathieud0001
December 21, 2024

Are these uploaded via a start form?

stefanhelzle0001
December 21, 2024

Depending on where you use this interface, you have to make sure that there is a correct mapping to process variables, when using at as a start form, or a mapping to AC variables when using it in a user input task.

jayaprakashr0001
December 23, 2024

can you mention the type of  ri!volunteerDocuments you are using to store the documents

mikes0011
Brainy
December 23, 2024

Echoing Stefan's answer, but simplifying somewhat: if you're seeing this error in a live task, 99% of the time it means you haven't assigned your form inputs (the interface's rule inputs) into an ACP variable, which is the only way to get user changes made on a form to populate when you want them to be passed back out into the process (like you will for uploaded files).

In the interface editor it will work because you have the component set to save into the RI.  But in a running process, the form wants to save from the component, to the RI, then to the ACP (aka "input variable" aka "ac!variable" etc), and when it doesn't get saved into an ACP, it doesn't save anywhere, then the rule input value resolves back to a blank one, thus the component resolves back to being blank.  This caveat is sadly just one you need to learn from experience, but after you know about it, it's pretty simple to handle luckily.

chrisg0006
January 2, 2025

Thanks for the feedback.  This is a portal, so there is no start form. Sorry, I failed to mention that. I have to call the process model.  However, I never get to that point.

First I use the a!fileUploadField function to upload the document and saveInto the ri!volunteerDocuments.

Then I use a!buttonWidget to create a button "Save Files" that uses the function a!submitUploadedFiles.  The button displays when the ri!volunteerDocuments are not null or empty.  The button never shows up.

Here is the complete JSON.

a!fileUploadField(
                        label: "Please upload any pictures, brochures or other documents describing the Project",
                        labelPosition: "ABOVE",
                        target: cons!PMSO_ApplicationDocuments,
                        value: ri!volunteerDocuments,
                        saveInto: ri!volunteerDocuments,
                        showWhen: if(
                          a!isNullOrEmpty(
                            local!applicationDocSubmissionSuccessful
                          ),
                          true,
                          not(
                            local!applicationDocSubmissionSuccessful
                          )
                        ),
                        validations: {}
                      ),
                      a!buttonArrayLayout(
                        buttons: {
                          a!buttonWidget(
                            label: "Save Files",
                            saveInto: {
                              a!submitUploadedFiles(
                                documents: ri!volunteerDocuments,
                                onSuccess: a!save(
                                  local!applicationDocSubmissionSuccessful,
                                  true
                                ),
                                onError: {
                                  a!save(
                                    local!applicationDocSubmissionSuccessful = false
                                  ),
                                  a!save(local!applicationDocError = fv!error)
                                }
                              )
                            },
                            submit: false,
                            style: "GHOST",
                            color: "ACCENT",
                            showWhen: if(
                              a!isNotNullOrEmpty(ri!volunteerDocuments),
                              if(
                                a!isnotNullOrEmpty(
                                  local!applicationDocSubmissionSuccessful
                                ),
                                not(
                                  local!applicationDocSubmissionSuccessful
                                ),
                                true
                              ),
                              false
                            )
                          )
                        },
                        align: "CENTER",
                        marginBelow: "NONE"
                      ),

stefanhelzle0001
January 3, 2025

There are no rule inputs in portals. At least not of type "Document". Use local variables.

I suggest to check the examples around the a!submitUploadedFiles() function.