Skip to main content
August 29, 2025
Question

Expression evaluation error: a!submitUploadedFiles() cannot be evaluated in this environment.

  • August 29, 2025
  • 11 replies
  • 0 views

I'm getting this error in my application 

I call the interface with the upload field in the forms and at one of the primary buttons i call the function a!submitUploadedFiles().    "at function a!buttonWidget".

I cant understand what can i do for this to work. Already checked the version of the buttons and forms. It's all up to date.

Can some help me ? 

11 replies

August 29, 2025

I forgot to say. My objective is to save the size of the document instantly after the upload. 

The fuction submitUploadedFiles() let me use the fv!file.size only in validations... But i need to save it... Appian could make it to the saveInto too :D :D 

mikes0011
Brainy
August 29, 2025
Appian could make it to the saveInto too

I've been asking for this feature for years.  You should go and upvote (and comment on) my Old Feature Request Thread, so more people will see it.

The answer to your original question is: a!submitUploadedFiles() (sadly) can not be used in a process task (task or start form) at all.  You'll need a different work-around.

August 29, 2025

Thanks a lot Mike!

Hope we can make noise to them hear us! 

Best regards, Nuno

shubhama926776
August 29, 2025

I tried to replicate your requirement, have a look at it(v25.3).

a!localVariables(
  local!document,
  local!documentSize,

  a!formLayout(
    contents: {
      a!fileUploadField(
        label: "Upload Document",
        target: {},
        /*Replace this with you target folder*/
        value: local!document,
        saveInto: {
          local!document,
          /* Handle list of documents */
          a!save(
            local!documentSize,
            if(
              or(isnull(local!document), length(local!document) = 0),
              null,
              document(local!document[1], "size")  /* Get first document */
            )
          )
        },
        maxSelections: 1  /* Limit to single file */
      ),

      /* Display the captured size */
      a!textField(
        label: "Document Size (bytes)",
        value: local!documentSize,
        readOnly: true
      )
    },

    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Submit",
          submit: true,
          saveInto: {
            /* Your other save logic here */
          }
        )
      }
    )
  )
)

August 29, 2025

I used it in an test interface. I'm using 25.1 version of Appian.

This error appears

 

It's because the document isn't saved anywhere and i can't access the document function because i dont have AppianDocId, i guess. Is that correct ? 

shubhama926776
August 29, 2025

No, Actually you are currently on 25.1 and 25.3 improved the file upload handling to make document properties available immediately in saveInto.

harshas2775
August 29, 2025

Here is a similar thread for your reference!