Workflow: HTTP templating produces incorrect output

What problem are you observing?

I sometimes get in the JSON sent by the HTTP request action values like "{{$.defineVariable.emailx}}" instead of an empty string ("").

What is the correct behavior?

Always produce an empty string ("").
Is there a support for nulls?

What are the steps to reproduce the issue?

Compare the output of the following workflows:

TESTAdamianSailPointJSON20240516(7).json (1.8 KB)
TESTAdamianSailPointJSON20240516(8).json (1.7 KB)

Just load them, go to test workflow - the standard test input is sufficient.

The presence of "emailchange": "{{$.trigger.changes[?(@.attribute == 'email')].newValue}}", influences the output of another field:

2 Likes

Thanks for the heads up! I am currently building a workflow with an HTTP request where I assumed a null value would indeed become “” instead of the variable path as you mentioned.

Let me test this on my side as well, but I assume this will yield the same result.

I assumed a null value would indeed become “”

In my test case $.defineVariable.emailx is not even null, but an empty string:

image


I’ve hit another, I guess, related issue. If the attribute lastname hasn’t changed (so it is not present in the list of changes)

{
    "lastNameNew": "{{$.trigger.changes[?(@.attribute == 'lastname')].newValue}}"
}

produces

{
  "lastNameNew": "[]"
}

instead of an empty string ("") (although I think it should be a null as it doesn’t match anything).

These issues make it very hard to pass the information to an external system which is interested in which attributes have changed (and hopefully no attributes that haven’t changed).

I am curious what workarounds are proposed and when we could expect a solution.

After a quick test, indeed this is not working.

My example, passing into the body of the HTTP request (amongst other things)

“IIQDisabled”: “{{$.getAccounts.accounts[0].attributes.IIQDisabled}}”

Where I know $.getAccounts.accounts[0].attributes.IIQDisabled is empty.

This results in the literal string value {{$.getAccounts.accounts[0].attributes.IIQDisabled}}.

2 Likes

My current (not nice) workaround:

  • define variables for everything

  • there still seem to be issues with some (e.g. $.getIdentity.attributes.jobTitle was not set as an empty string), so I use this additional hack:

Note: when you define the replace transform you can’t use the empty string, you have to type something (only spaces are not supported either :slight_smile: ), and then go to Advanced (the editor) and replace the string to "".