Hello community,
I wonder if this a bug or I am doing something wrong.we use Appian 20.4.
If I try to get the data of a map using index or property it always returns default value when present.This behavior only occurs in the process model and not in a expression object.e.g.pv!testMap: a!map(errormessage: "something went wrong"),
then this code property(pv!testMap, "errormessage", "default") or the same using Index function.Will return "default".
dot notation works: pv!testMap.errormessage wil return: "something went wrong".property or index without a default works: property(pv!testMap, "errormessage") wil return: something went wrong".
Maybe I overlook something, got it working by the way by casting the map to a map but that makes no sense off course.
Kind Regards,
Erik
Discussion posts and replies are publicly visible
Hi Erik
This works fine in an expression rule:
a!localVariables( local!data: a!map(errormessage: "something went wrong"), fn!index(local!data,"errormessage", "default") )
...so (to unblock you) you could call an expression rule form your process to get the result you want. Arguably this would be best practice anyway as the more code you "embed" in a process model harder it becomes to test as independent units of logic.
Thanks Stewart,
Unfortunately that doesn't work.
It does work in expression editor, but the behavior somehow changes in the process model when the expression is called in the Node. Casting the map to map fixed this, so got it working.
Ho Erik
Strange, I just tried this. I create a process model with a pv! of type Map, set its value as you described, called an expression rule that indexes into that Map to return the value at that index and it works as expected.