So, I have a form for " Document Details", the user can enter as many documents as they want.
and when they add a document, it should appear in the grid.
I declared " local!indexNum" as index , so the user can enter many documents.
And here is an example code of how i entred data:
a!dropdownField( label: "Main Type", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", choiceLabels:local!type['recordType!{ba0dd34e-52a6-4f09-ba3a-dd6885feda5b}SKJ Main Type.fields.{e5eb76e0-4885-44d7-b9c3-263533a5f721}descEn'], choiceValues: local!type['recordType!{ba0dd34e-52a6-4f09-ba3a-dd6885feda5b}SKJ Main Type.fields.{4a008dc7-3ea8-466e-a515-75c5cb965a49}itemCode'], value: if( a!isNotNullOrEmpty(local!filled), ri!DocDetails[local!filled].mainType, ri!DocDetails[local!indexNum].mainType ), saveInto: {ri!DocDetails[local!indexNum].mainType}, searchDisplay: "AUTO", required: true, validations: {} )
The thing is that in the grid, and even in the database it only saves the value of the first entry and duplicated it for others:
But the ri!DocDetails seems to have different values for the 2 different items.
This is what is in the "Add a document" button :
a!buttonWidget( label: "Add A Document", icon: "plus-circle", value: true, saveInto:{ local!clicked, a!save( ri!DocDetails, append(ri!DocDetails,local!documentDetails)), a!save(local!addDoc,false), a!save(local!indexNum,local!indexNum + 1), a!save(local!addnewdocument,local!addnewdocument + 1) }, style: "LINK" )
Tell me if you need to see more of the code .
Discussion posts and replies are publicly visible
From what I can tell from the screenshots it looks like you are not setting the Request ID so those documents will not be associated with any request?
Yeah it's not passed for now , but later the request id should be passed in the script task in the process model.
and all these documents are associated with the same request (Each request can have many documents)
but anyways, does this have anything to do with the duplication of the first entry?
And I am currently adding to database using smart services, (Later I'll switch to process model)
Can you show the code in the script task? Can you also show variables in the Process Properties?