index or property function always returns default value in process model even when the property is in the bean(map)

Certified Associate Developer

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

Parents
  • 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.

Reply
  • 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.

Children