Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Flatten a nested list

Evan Yeung September 5, 2023

Hi,

I am doing a Lookup Objects function to get all the roles that can be assigned to an app and get the approvers for the roles. 

The output of {{lookupObjects.Approvers}} looks something like this

[5b2...579, 610...1f6], 610...1f6

and if I do {{lookupObjects.Approvers.size}} I get "2" returned, so it appears I have a nested list. I want to flatten this list so I can perform de-duping and set the Approvers field with the list of users. 

I have tried split() and join() without much luck. And I also tried using a for each loop, but I seem to be running into a problem with order of operations. 

Is there anything neat tricks I can do to flatten this list?

1 answer

1 accepted

0 votes
Answer accepted
Evan Yeung September 6, 2023

Apparently there is a `flatten()` command, learned that in here https://confluence.atlassian.com/jirakb/auto-populate-approvers-from-asset-objects-attributes-1072474097.html

That worked nicely, and then I was able to use `distinct()` on it to get my list of Approvers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events