Deprecated Set Variable Action

Wanted to share a quick tip with the community! This will only happen for apps pre-dating CXR 17.0 so hopefully that means it’s mostly a rare case. Anyway, before CXR 17 the “Set Variable” action worked a bit differently and the logic has since been updated. For backwards compatibility “Set Variable” actions for App previous to the CXR 17 release, were converted to “Deprecated: Set Variable” actions keeping the old logic in place. Let’s explore the difference:

  • Before CXR 17 (“Deprecated: Set Variable”), the logic was to add the values. So:
session.foo = {a:A}, then session.foo = {b: B} = session.foo = {a:A, b:B}
  • After CXR 17 (“Set Variable”), the logic is to overwrite the values. So:
session.foo = {a:A}, then session.foo = {b: B} = session.foo = {b:B}

So that’s it, there’s no harm in having “Deprecated: Set Variable” actions in old Apps just keep in mind the difference in behavior. Also newer Apps won’t be able to add new “Deprecated: Set Variable” actions although the same behavior can be achieved by the use of MERGE_OBJECTS:

MERGE_OBJECTS({a:A},{b:B})

That’s it! Hope you find it helpful :slight_smile:

5 Likes