In the workflow manager its possible to use a action calculated field.
This is a SuiteCrm functionality, which is documented here: https://docs.suitecrm.com/user/advanced-modules/workflow-calculated-fields/
The DataEngine adds the following functions:
GetValueForKey
Signature {GetValueForKey(parameter1;parameter2)}
Parameters
parameter1: A base64 encoded serialized php array
parameter2: The key to fetch. Use .
to access nested keys
Description
Get a value from a serialized php array by key.
Returns
The value for the key or null if the key does not exist.
Example call
{GetValueForKey({P0};abc)}
– Get the value for the key abc
from the serialized php array in parameter 0.
{GetValueForKey({P0};abc.def)}
– Get the value for the key def
in abc
from the serialized php array in parameter 0.
Base64Encode
Signature {Base64Encode(parameter1)}
Parameters
parameter1: The string to encode
Description
Encode a string to base64.
Returns
The base64 encoded string.
Example call
{Base64Encode(abc)}
– Encode the string abc
to base64.
Base64Decode
Signature {Base64Decode(parameter1)}
Parameters
parameter1: The base64 encoded string to decode
Description
Decode a base64 encoded string.
Returns
The decoded string.
Example call
{Base64Decode("YWJj")}
– Decode the base64 encoded string YWJj
to abc
.
CreateJSON
Signature {CreateJSON(parameter1;parameter2;parameter3;...)}
Parameters
parameterX: The key and value to add to the json object. The key and value are seperated by a .
Description
Create a json object from the given parameters.
Returns
The json object string.
Example call
{CreateJSON(abc.def;ghi.jkl)}
– Create a json object {"abc":"def","ghi":"jkl"}
.
{CreateJSON(name.{P0};value.{P1})}
– Create a json object {"name":<Value of P0>,"value":<Value of P1>}
.
JsonExtract
Signature {JsonExtract(parameter1;parameter2;parameter3)}
Parameters
parameter1: The json object string
parameter2: The key to fetch
parameter3: The default value if the key does not exist
Description
Get a value from a json object by key.
Returns
The value for the key or the default value if the key does not exist.
Example call
{JsonExtract({P0};abc;default)}
– Get the value for the key abc
from the json object from parameter 0. For {"abc":"def","ghi":"jkl"}
would return def
{JsonExtract({P0};xyz;default)}
– Get the value for the key xyz
from the json object from parameter 0. For {"abc":"def","ghi":"jkl"}
would return default
.
JsonExplode
Signature {JsonExplode(parameter1;parameter2;parameter3)}
Parameters
parameter1: A string value seperated by the parameter 2
parameter2: The separator
parameter3: Default value. Caution this returns the value directly not an json array!
Description
Explode a string value to an json array.
Returns
The json array string.
Example call
{JsonExplode(abc;,;ghi)}
– Explode the string abc
to an json array ["abc"]
.
{JsonExplode(abc,def;,;ghi)}
– Explode the string abc,def
to an json array ["abc","def"]
.
{JsonExplode(;,;ghi)}
– Explode the string “ to ghi
as the value is empty.
{JsonExplode({P0},/n;ghi)}
– Explode the string from parameter 0 by new line to an json array. For the value
abc
def
ghi
the result would be ["abc","def","ghi"]
.
JsonImplode
Signature {JsonImplode(parameter1;parameter2;parameter3)}
Parameters
parameter1: A json array string
parameter2: The separator
parameter3: Default value. This is only used if the json is invalid!
Description
Implode a json array to a string value.
Returns
The string value.
Example call
{JsonImplode({P0};,;)}
– Implode the json array from parameter 0 to a string value. For ["abc","def","ghi"]
the result would be abc,def,ghi
.
{JsonImplode({P0};,;invalid_json)}
– If parameter 0 is not a valid json the default value invalid_json
is returned.