Is is possible to update multiple fields of a CDT using the a!update()? The documentation shows that you can for a regular array, but with the CDT examples shown, it only updates one field at a time. When I test it out in an expression, it throws an error. I just want to check that I'm not missing anything here.
e.g.
a!update( data: ri!submission, index: {"StatusID", "SubmissionTypeID"}, value: {1, 2} )
error thrown: Expression evaluation error at function a!update: Invalid index: cannot index multiple indices of type List of Text String into type CRA_T_Submission
Discussion posts and replies are publicly visible
I have reported this to Appian recently, because I found the same issue with testing. It throws the same error when you try with either a Dictionary or with a CDT (surprisingly), but works if you feed it a MAP specifically. Which is weird. I was really looking forward to replacing the "update dictionary" plug-in, but as it stands, a!update() is not usable for that in 99% of my current use cases.
Working (a!map):
Not working (dictionary):
Edit to add in retrospect: as of 21.4, the nonworking cases I mentioned earlier now seem to work.
You can use fn!reduce() in the same way you would with any list that you want to process against an initial value:
fn!reduce( a!update, ri!submission, fn!merge( {"StatusID", "SubmissionTypeID"}, {1, 2} )
...but I take your point, it seems odd/inconsistent that it natively processes a list for maps but not for Dictionaries or CDTs.
I mean, if you have to pull in (two[!!]) primitive looping/array functions to make one of the most basic use cases work, to me that defeats the entire purpose of the new Update function, when compared to updateDictionary() which works just fine in one step.
This is a known bug with updating dictionaries and CDTs with a!update(). This will work as expected for maps and record data types. We are working to fix the issue, but I don't have a timeline for the fix right now.