Hi,I am facing an issue where I am getting Expression evaluation error at function a!forEach [line 44]: Error in a!forEach() expression during iteration 1: Expression evaluation error in rule 'es_copy_ucaa_cmpt_fileupload' at function a!fileUploadField [line 27]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function fn!content_appian_internal [line 35]: Invalid Content ID.please help me to resolve this issue
a!fileUploadField(label: ri!label,labelPosition: if(a!defaultValue(ri!showLabel, true),null,"COLLAPSED"),helpTooltip: ri!helpTooltip,target: ri!folderId,value: index(ri!documents, "appianDocId", null),saveInto: {a!save(ri!documents,a!forEach(items: tointeger(save!value),expression: a!update(data: cast('type!{urn:com:appian:types:PRI}PRI_Document',rule!GBL_indexWhere(value: fv!item,initialArray: index(ri!documents, "appianDocId", {}),finalArray: ri!documents)),index: {"appianDocId","questionAttribute","questionName","documentIdentifier"},value: {fv!item,ri!questionAttribute,ri!questionName,ri!identifier})))},required: ri!isRequired,requiredMessage: ri!requiredMessage,buttonDisplay: "ICON",maxSelections: ri!maxDocuments)
Discussion posts and replies are publicly visible
This error usually occurs when document does not exist. You can simply check if document exists then only show fileupload() field. You can use something like:getcontentobjectdetailsbyid(ri!docId ) <> "No object with this ID has been found"
Could you please help with more details like in which scenario you are facing this issue?....
Are you submitting uploaded file in the form through start process or similar?
This issue will happen when the type of variable is not document, or the target contains default data like 0
Check the variable ri!documents.appianDocId. It should be of type document. Also, in saveinto there is a foreach, check the items and do not convert the save!value to integer