A workflow is getting triggered if old value of department attribute changes. So, I am fetching the oldValue in workflow using “$.trigger.changes[?(@.attribute==“department”)].oldValue” and update the value in JSON body to trigger a service now request.
Problem: If old value is empty for department attribute, then I can see whole syntax “$.trigger.changes[?(@.attribute==“department”)].oldValue” on JSON body instead of updating with empty or null value. Due to which I am getting below
Error: Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character ‘j’ after object key:value pair
Any suggestion how to avoid this issue and place a “null” if old value is empty.
It seems this is currently how JSONPath behaves in ISC: when the expression cannot resolve a value, instead of returning null or an empty value, it returns the entire JSONPath expression as a string.
If your workflow is currently triggered only based on the department attribute, you could use the Verify Data Type operator to check whether the old department value exists. Based on the result, you can take two different paths:
True path: The old department value exists, so you can use the JSONPath expression to retrieve it.
False path: The old department value is empty/missing, so you can explicitly set the value to null.
@iamnithesh workflow is getting trigger even if values are null or empty. But the issue is if th old value or new value is empty or null then its returning JSONPath expression as a string.