Parse Array as String to httpRequest in Workflow

Looking for ideas on how to support the following use case:

  • Client has a workflow that runs and opens a ServiceNow ticket for a user on termination. Before the workflow runs, we are removing all of the AD groups for the user on termination using SailPoint

  • They want to add the list of removed AD groups in the ticket body

  • We are able to get the list of removed groups as an array (e.g., [group1, group2, group3]) using the search feature

  • Since the value is an array, we aren’t able to pass it into the ticket body, as the array is removed when SailPoint is processing during the workflow

Any ideas on how we can workaround the known jsonPath limitation to be able to bring the removed groups into the ServiceNow ticket?

Hello Margo,

The “Get Access” action returns an array of entitlement, which you can serialize using .JSON(), you can embed something like this {{$.getAccess.accessItems.JSON()}} into your ticket, or maybe use a loop to only retrieve the names of entitlements? Or you’re saying that the ticket doesn’t accept JsonPath ?

Can you share your workflow with us, if possible ?

Best Regards

Youssef

Thanks Youssef, I’ve attached a simplified version of the workflow. The issue appears in a request to patch a ticket (not included in the sample), because the array is not processed correctly. As an example, the request body renders to the below, which then throws the following error:

“Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character ‘C’ after object key:value pair”

Sample JSON body is rendered to….

"jsonRequestBody": "{\"description\":\"User Successfully Disabled Account for TestUser\\n\\nAD groups removed are\\n [\"CN=Group1\",\"CN=Group2\",...,\"CN=GroupN\"]\"}",

CopyofLeaver20251127.json (2.7 KB)

can you define a variable in the workflow and transform array to string. This post might be of some help :

Hello,

Exactly Chelsea, that’s the idea for me as well to cast an array to string :

For “replace” option in “define Variable”, you should first put a character like “a”, then remove it in advanced tab.

This assumes that your search returns an array of strings, being also between quotes

Best Regards,

Thanks for the suggestion both - I did try this before but the define variable step does not render the jsonPath within quotation marks so I can’t leverage the replace function. What you can see is that it will return the array directly and not in quotations (see how it goes directly to [ and not "[ ) which results in the output being rendered as an empty string. Any other ideas that could be leveraged?

image

image