Hi
when i uplaod a doc to the grid , it returns this error shown in image below(Document must be indexed by its corresponding record type fields or relationships) .
ALSO the name field shows [Reaction Tree] what is that?
where exactly am i supposed to fix the indexing? how to resolve this issue ?
local!document:rule!SKJ_GetDocumentByDocId(local!ac), a!sectionLayout( label: "Documentation Details ", labelIcon: "file-text", labelSize: "SMALL", labelColor: "STANDARD", contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!gridLayout( totalCount: count(local!document), headerCells: { a!gridLayoutHeaderCell(label: "Document" ), a!gridLayoutHeaderCell(label: "Name" ), a!gridLayoutHeaderCell(label: "Classification" ), a!gridLayoutHeaderCell(label: "Uploaded By" ), a!gridLayoutHeaderCell(label: "Uploaded On" ) }, columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:2 ) }, rows: a!forEach( items: local!document, /*localdata*/ expression: a!gridRowLayout( id: fv!index, contents: { a!fileUploadField( target: cons!SKJ_DOCUMENTS_FOLDER, maxSelections: 1, value: /*local!doc,*/ fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{6c686146-7506-45c1-b2e6-1db2e0eb6900}appianDocId'], saveInto: {/*local!doc*/ fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{6c686146-7506-45c1-b2e6-1db2e0eb6900}appianDocId'], a!save(fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{66325d17-158b-4776-98b3-761a5a458e5c}addedBy'],loggedInUser()), a!save(fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document'],1), a!save(fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{1fc16e35-b769-46b0-8d9e-9dc633cbb090}addedOn'],today()), a!save(fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{f65ae4e8-afd3-4a5a-80c7-3c67d225a274}docName'],extract(fn!getcontentobjectdetailsbyid(fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{6c686146-7506-45c1-b2e6-1db2e0eb6900}appianDocId']), "Name:", ".")) /* a!save(fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{6d510991-df65-4ae0-a9b9-179a36931fb0}docId'],document(documentId: local!doc, property: "id"))*/ }, buttonDisplay:"ICON",buttonStyle: "STANDARD"), a!textField( value: a!save(fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{f65ae4e8-afd3-4a5a-80c7-3c67d225a274}docName'],extract(fn!getcontentobjectdetailsbyid(fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{6c686146-7506-45c1-b2e6-1db2e0eb6900}appianDocId']), "Name:", ".")), saveInto: 'recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{f65ae4e8-afd3-4a5a-80c7-3c67d225a274}docName' ), /* For the Department Column*/ a!dropdownField( label: "department " & fv!index, placeholder: "-- Select -- ", choiceLabels: { "First", "Sec"}, choiceValues: { 1, 2 }, value: fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{a3f411dd-394e-4039-a2d0-600d333f94b0}classification'], saveInto:fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{a3f411dd-394e-4039-a2d0-600d333f94b0}classification'], required:false ), a!textField( value:local!addedBy ,/*fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{f65ae4e8-afd3-4a5a-80c7-3c67d225a274}docName'],*/ saveInto:fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{66325d17-158b-4776-98b3-761a5a458e5c}addedBy'], required:true ), a!textField( value: today(), saveInto: fv!item['recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document.fields.{1fc16e35-b769-46b0-8d9e-9dc633cbb090}addedOn'], required:true ) } ) ), showWhen: not(isnull(index(local!selectedEmployees,1,"null").accountId)), addRowlink: a!dynamicLink( label: "Add Document", value: append(local!document,'recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document'()) , /*startDate: today() + 1},*/ saveInto: { a!save(local!document, append(local!document, save!value)) /* a!save(local!employees, append(local!employees, save!value))*/ } /* saveInto: { a!save(local!document, append(local!document, save!value)) }*/ ), rowHeader: 1 ) } ) } ) }, showWhen: not(isnull(index(local!selectedEmployees,1,"null").accountId)) ) } ) } ),
Discussion posts and replies are publicly visible
ok regarding the reaction tree , i fixed it .
but the indexing error is still there
In line 43 you store the number "1" into the record instead of a field.
A "reaction tree" is the return value of an a!save() and is a data structure to be evaluated in a "saveInto" parameter only.
if i want to replace the local variable in the dynamic link "local!document" with a rule input ,
what is the right syntax to do so?
do i still need the append function ?
I am not sure I understand what you mean. Can you explain like to a four year old?
So, The uploaded document is not being added to the database, and i think the reason is , because i am saving it in a local vairable (local!document )- Line 89 -and not a rule input. I created a new rule inpute (ri!Doc) of type Document and tried to save the documents in that rule input (i also added a write record in the process model) yet , it does not work . and the process model return errors when i debug it :
This process model could not be published due to the following errors. Please correct them before continuing.
addRowlink: a!dynamicLink( label: "Add Document", value: append(local!document,'recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}SKJ Document'()) , /*startDate: today() + 1},*/ saveInto: { a!save(ri!Doc,local!document) /* a!save(local!document, append(local!document, save!value)),*/ /* a!save(local!employees, append(local!employees, save!value))*/ }
So, documents in Appian get only finally uploaded on a submit action and when stored in a rule input.
It seems like you want to store the ID of the document in a record. So the value and saveInto of the file upload field should be fv!item[recordfield]. That is, if you include the upload field in the grid.
Does that help you?
I only want to change the saving from a local variable to a rule input ,
cant i just use a!save (ri!doc, local!document) ?
can you please tell me exactly what changes i should make to a!dynamicLink to make it save in a rule input?
addRowlink: a!dynamicLink( label: "Add Document", value: 'recordType!{52d6bfd4-9a4e-457c-ab2e-ede6cffdb054}'(), saveInto: { a!save( local!document, append(local!document, save!value) ), a!save( ri!doc, local!document ) } ),