Expressions: Iterate over a list

I retrieve a list of objects in a microflow, when the list is not empty I will sent an email to inform the users of the found objects.  The action to sent the email has an argument to set the text for the email. I want to text to be something like: 'Dear user, we found '+ $numberFound + ' objects' + 'The found objects are ' + for(result : resultList) { '$result/name ' }   Would it be possible to iterate over the list within the argument editor or do I need to create the result names outside this action and use that variable in the argument editor?
1 answers

You can create a empty string outside of the loop, and then with every iteration add the $Result/name value (+ a return) to the string, this way you build a list as string which you can use as a token for the e-mail. (Note that, when using the tokenReplacer functionality, you'll need to commit this string to the database, and configure a tokenObject for that specific database value before sending the e-mail.)