Inline Variable Logic?

Hello SailPoint Devs,

I’m wondering if anyone is aware of a way to populate a different value if an inline variable is empty, like null.

I’m trying to pass various fields in a http action JSON PUT body and it fails since some of the values can be optional.

I am trying to avoid a monstrous amount of branching. If I tackle this with verify data type I’d be building a dozen different http actions.

Thanks for any and all suggestions!

Have you tried creating the message body as a variable and updating it using the update variable step for each possible optional attribute?

Create a variable for body containing a “{”

Use a comparison to determine whether the attribute is present. If it is, add it to the body.

be sure quotes and colon are included. (edit: updated the updateVariable operator to start with the existing patchBody value - so it’s not replacing, it’s appending)

Before the HTTP request, add the closing “}”

Make the HTTP request with the variable as the body:

To be clear, this is a brainstorm, not something I’ve actually tested. It will require a comparison for each optional attribute, but it keeps you from having to setup multiple HTTP requests depending on what the body might look like.