I’m trying to see if it’s possible to format an Array in the format below into the string output below. I have an array coming from a trigger in my workflow that needs to be formatted into a comma separated list without knowing the total size of the array. I was thinking about hard coding it all in a DefineVariable, but that doesn’t work when introducing different array sizes. Is there an easy way to do this with a loop that I’m not getting?
Not sure if it works as i have not tested this, but based on my understanding, Try using Java docs | SailPoint Developer Community " * * connector.common.Util**" listToCsv(java.util.List list) which returns string from a list.
you can use this to write a custom rule and then create a custom transform of type rule like below:
{
"type": "rule",
"name": "Join Array to String Transform",
"input": {
"type": "reference",
"transform": "MyArrayAttribute" // Reference to the array attribute
},
"delimiter": ", " // The character(s) to use between array elements
}
I’ve attempted to solve this a few times in my workflows, but come up with pretty much the same struggle as you. We have in input of multiple user Ids, and pushing that into an Identity Search.
The best that were were able to come up with using the static entries. Ideally, you add in too many array entries, and use the replace to get rid of the invalid ones. In our case, we break it out into two separate define variables. One to extract the values from the array, and a second to format it. To get around the NULL issue add them as text using the {{$.array[0]}} format. Then in your second define variable, you can use a regex pattern to get rid of extra commas and variables that failed to compute. It is a little overly complicated, but it works if you know the upper side limit of how many elements are in your array.
@jrote01 , I’m trying to take this string output and use it as input for another form or an email. Basically it’s being used to display the information in the array for approval purposes. My upper bound is 30, so hard coding the array values I don’t think will work in my case. But theoretically, I could just use 1 definevariable operation with 30 variables and take the outputs of that into a second define variable that concat’s each of the 30 variables?
@LEOS , I attempted this, but it appears to display no text when testing the output in a form or email. Keep in mind, my variableA input is an Array of Strings. Does this only work for string inputs?