Hi Team!
I am constructing a workflow to notify when an identity that is owner of an object in IDN is about to be off-boarded.
To do this I use the “Get List of Identities” Action and use it as input to a Loop where I send a /search HTTP request that fetches objects that are owned by these identities. I then use the request body of this HTTP request in a “Send Email” action where I want to print the Object Name and Object Type.
I have made 2 variables:
"accessList.$": "$.hTTPRequest.body[*].name"
"accessType.$": "$.hTTPRequest.body[*].type"
I am able to fetch the data needed, however when there lists are returned, I am unable via velocity code to loop these lists and split the values into separate rows of a table.
Result when there is only 1 object:
Result when there are several objects:
I have tried to separate items when Arrays are returned, to no success. I’m not sure the Velocity engine in IdentityNow supports the code I have tried.
I have tried different code but here is an example:
<thead>
<tr>
<th>Access Type</th>
<th>Access List</th>
</tr>
</thead>
<tbody>
#if ($accessType && $accessType.getClass().isArray())
#foreach ($index in [0..$accessType.size() - 1])
#set ($typeItem = $accessType[$index])
#set ($item = $accessList[$index])
<tr>
<td>$typeItem</td>
<td>$item</td>
</tr>
#end
#else
<tr>
<td>$accessType</td>
<td>$accessList</td>
</tr>
#end
</tbody>
This code breaks the email.
Does anyone know how to split the values of the arrays and put these in a table with separated rows?
I have also tried simply replacing square brackets and commas if there are arrays returned like so:
<thead>
<tr>
<th>Access Type</th>
<th>Access List</th>
</tr>
</thead>
<tbody>
#set($typeItems = $accessType.replaceAll("[\\[\\]]", "").split(","))
#set($itemValues = $accessList.replaceAll("[\\[\\]]", "").split(","))
#foreach($index in [0..$typeItems.size() - 1])
#set($type = $typeItems[$index].trim())
#set($item = $itemValues[$index].trim())
<tr>
<td>$type</td>
<td>$item</td>
</tr>
#end
</tbody>
Thankful for any help!
Workflow screenshot: