Unable to parse input as JSON body for HTTP action in workflow

Hello,

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.

Thanks,
Deepak

Hi @vemadeepak

This is already a known behavior in ISC, as described here by a SailPoint employee: “The behavior reported is by design and not a bug. If the JSONPath cannot resolve, then it remains as the JSONPath.” You can also find a similar discussion here: Workflow - Define Variable: Blank/missing value outputs the JSON variable path - Feedback / Bugs - SailPoint Developer Community

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.

You can try different option available on Data Type if Exists condition doesn’t work. Is Null for example.

This would introduce two paths with the same actions, but unfortunately, I’m not aware of any other options at the moment.

Thanks.

If your workflow needs to trigger for department change even when the previous value is null use this for the trigger filter

$.trigger.changes[?(@.attribute==“department”)]

@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.

Depending on your logic you need to do the null check and proceed only when the values are not null

I agree with @iamnithesh here that you’ll need to do that null check yourself and then choose the appropriate path from there.