Unable to detach file from a!fileUploadField

Hello,

I have a problem with a form interface where users are supposed to be able to drop a file with a a!fileUploadField, but if the user tries to detach the file before submitting form or to detach it by updating the record, I have this error :

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = U7CHV] : An error occurred while executing a save: Expression evaluation error: Cannot update List of LIH Attach; length of assign value list (0) does not match length of the list to update (1)

I have already used this in another interface and it worked, the only difference is that the value and saveInto are using a relationship this time.

Here is the code :

a!fileUploadField(
                  label: "Pièce jointe",
                  labelPosition: "ABOVE",
                  placeholder: "Placez la pièce jointe ici",
                  target: cons!LIH_GET_ATTACH_CONTRIBUTION,
                  maxSelections: 1,
                  value: ri!recordContribution['recordType!{58f0a27e-e82a-45c8-a2ba-447508f8a5c2}LIH Contribution.relationships.{8b2cb979-71b4-4926-819d-b9cdd9b68eda}lihAttach.fields.{e8f68519-d34f-4654-b900-151916fafe5a}docId'],
                  saveInto: ri!recordContribution['recordType!{58f0a27e-e82a-45c8-a2ba-447508f8a5c2}LIH Contribution.relationships.{8b2cb979-71b4-4926-819d-b9cdd9b68eda}lihAttach.fields.{e8f68519-d34f-4654-b900-151916fafe5a}docId'],
                  validations: {if(
                    or(fv!files.size > 2000000), 
                    "Le fichier ne peut pas faire plus de 2MB. Merci de retirer : " & 
                    index(fv!files, "name", where(fv!files.size > 2000000), {}), 
                    ""
                  )}
                )

Someone already created a topic about this but there was no response in months so I'm asking it again.

Thanks for any help you could provide

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    That's no surprise. You try to write a list with zero items into a single field in a related record.

    I did never try this specific situation myself, but when I try to store document data to a list of records, I do that directly in the saveInto. What I mean is, to run a foreach on save!value creating a record structure for each file, and then store that to the rule input.

Reply
  • 0
    Certified Lead Developer

    That's no surprise. You try to write a list with zero items into a single field in a related record.

    I did never try this specific situation myself, but when I try to store document data to a list of records, I do that directly in the saveInto. What I mean is, to run a foreach on save!value creating a record structure for each file, and then store that to the rule input.

Children