The Workflows team has just released two updates to the workflow engine.
Correct string length
Previously, there was an issue in the JSONpath library used by Workflows that always added 2 to the length of a string when using a JSONpath like $.string.length()
. This did not affect arrays. A string like “hello” would result in a value of 7 when using the .length()
function. This has been fixed in the latest release, and the length function will now return the correct length, which is 5 in the “hello” example.
Please be aware that this change may affect workflows that utilize the
.length()
function to calculate the length of strings. Please check your workflows for usage of.length()
to see if this change will impact you.
Support for objects and arrays in inline variables
Previously, inline variables only supported strings, numbers, and booleans. Inline variables that referenced objects or arrays would output Golang serialization strings, which could cause issues when trying to make HTTP Requests. For example, trying to use $.trigger.identity
, which references an identity object, would result in this string.
map[id:ee769173319b41d19ccec6cea52f237b name:john.doe type:IDENTITY]
With the latest release, inline variables now supports JSON serialization of objects and arrays with the use of the .JSON()
function. If you need to use an object or an array in an inline variable, and you need it to serialize to JSON, add .JSON()
to your JSONpath to force it to serialize to JSON. For example, $.trigger.identity.JSON()
produces the following output:
{
"id": "ee769173319b41d19ccec6cea52f237b",
"name": "john.doe",
"type": "IDENTITY"
}
You do not need to use the .JSON()
function to serialize numbers, strings, and integers.