JSON Export Node
Provide the ability to generate JSON output from process data.
The node will allow for authoring a JSON styled template, and will map the output based on field names written into the template.
Example Template:
{
"Vendor":@@Vendor Name@@,@@PO Field Descriptor@@:@@PO Number@@,
"Amount":@@Invoice Amount@@,"Invoice Date":@@Document Date@@,
"Approvers":[
@@MV Approver List@@
],
"Invoice Lines":[@@Line Items[0,1,3,4]@@]
}
Use two @ symbols to represent a process field in the JSON template.
For standard and multi-value fields, Character and Date data types are written as JSON strings, meaning they are wrapped in quotes. Numeric values are written as numeric, meaning no quotes. All table fields are written as character, with quotes.
Multi-value fields are written in their entirety in a comma delimited form. In the example above, @@MV Approver List@@ would be represented like:
“Steve”, “Brian”, “Dan”
This results in a valid JSON structure when injected into the JSON as defined:
"Approvers":[
"Steve","Brian","Dan"
]
Table fields are written in their entirety (all rows) for the table columns specified. All Table Field columns are written as strings. In the example above, @@Line Items[0,1,3,4]@@ will output an object for each row:
{“GL Code”:”100-299300-01”, “Quantity”:”20”,”Amount”:”124.67”}
This results in a valid JSON structure when injected into the JSON as defined:
"Invoice Lines":[
{“GL Code”:”100-299300-01”, “Quantity”:”20”,”Amount”:”124.67”},
{“GL Code”:”100-726352-01”, “Quantity”:”1”,”Amount”:”88.98”}
{“GL Code”:”100-763521-01”, “Quantity”:”23”,”Amount”:”12.95”}
]
Node Setup
Provide a JSON styled text block in JSON Output. Remember to wrap process field names in two @ symbols on both sides. This works for all field types, but exists primarily for complex field types like Multi-Value and Table fields.
Process field notations may also be embedded in the JSON string. This can be used in scenarios where you know precisely the data you want to map. For example, if the workflow logic dictates that you know row 1 column 2 of a table field should always be injected into a specific JSON field, it may be expressed in notation form like:
{“Cell Value”:{p_Table Field[0][1]}}
Notation can also be helpful in cases where the JSON expects descriptive fields, like:
{“Item Count”:2, “Items”:[“Element 1”,”Element 2”]}
Which would be expressed in notation form like:
{“Item Count”:{p_MV Field_length}, “Items”:[@@MV Field@@]}
Additionally, if you wish to concatenate multiple single value fields, notation can express that like:
{“WholeName”:”{p_First Name} {p_Last Name}}
Specifically when using notation, basic calculations can also be performed with appropriately typed fields:
{“Invoice Total”:”{p_Invoice Amount} + {p_Tax Amount}”}
Optionally, the JSON output can be written to a process field on the original process.
Optionally, the output JSON can be validated. Check the “Error process if rendered JSON is invalid”. This option ensures the JSON generated is valid.
Workflow
The JSON Export node is a conditional node with two outputs (Original Process and JSON File). There will always be two routes out, but those two paths can merge downstream in the workflow.
Original Process
The original process is the standard route the source document should take in the workflow.
JSON File
The node, on successful processing of the process' data, will spawn a new workflow process and attach the JSON output as a file in that new process. This will allow the JSON output and the file output to potentially take two different paths if that’s necessary for the workflow.
There will ALWAYS be two processes on successful processing of this node. Cloud customers should note that this will add 1 page to the page count consumed.
The JSON export SHOULD NOT target an End Node directly.
Field Names should not contain square brackets.
The JSON file generated is a new process. That process does not carry through the data of the original process. If you need to link the source process and new process, note that the ORIGINALFILENAME property of the new process will contain the original Process ID. You may use this process ID to link the output JSON to the original process.