JSON() Works for Lists but Breaks for Single Values

Hi Everyone,

There’s a multi-selection form field. When a single value is selected, the workflow receives it as a string, but when multiple values are selected, it is returned as a list.

This value then needs to be passed to another workflow as part of a payload. The issue arises because the payload uses inline variables, and inline variables automatically convert lists into strings. To work around this,.JSON()has been used, which correctly handles lists—but it breaks when only a single value is selected, since that input comes through as a string
Payload used:

{“accessToAdd”: {{$.interactiveForm.formData.selectAccess.JSON()}}}

In case of multiple selection, payload evaluates to -

{“accessToAdd”: [/“Test11/”,/”Test2/”]}

In case of single selection, payload evaluates to -

{“accessToAdd”: Test1}

however, it expects single value in quotes like, {“accessToAdd”: “Test1”}

Now, if payload is added with quotes as,
{“accessToAdd”: “{{$.interactiveForm.formData.selectAccess.JSON()}}”}, then it converts list into string hence single selection works fine but list starts to fail

Has anyone encountered this?

Hello,

You could try using the “Verify Data Type” in the workflow:

1) If selectAccess is a string
Use normal inline variable with quotes (no .JSON()):

{ "accessToAdd": "{{$.interactiveForm.formData.selectAccess}}" }

2) Else (it’s a list/array)
Use .JSON() without quotes:

{ "accessToAdd": {{$.interactiveForm.formData.selectAccess.JSON()}} }

That gives you:

  • single: { "accessToAdd": "Test1" }

  • multi: { "accessToAdd": ["Test11","Test2"] }

Yeah, that’s the last option to opt for, because with three multi‑select form fields, It’d need multiple data‑type checks, null checks, and several additional steps to call the other workflow—each requiring different inline variable formats, with or without quotes

Shouldn’t this ideally be fixed / unified in the form (by SailPoint) to always return a list for such a multi-select field? Otherwise, you’re just propagating the issue downward to be faced by multiple workflows, in multiple tenants, faced by multiple ISC customers.

1 Like

Validated the multi-select form value type and null check first then had to use multiple duplicate steps to call another workflow which used different variables based on the multi-select field value type as list or string, such as-

{“accessToAdd”: “{{$.interactiveForm.formData.selectAccess.JSON()}}”}
{“accessToAdd”: {{$.interactiveForm.formData.selectAccess.JSON()}}}