Within my flow, I'm just about done but I am running into an issue.
I am using the Search for Users v2 to get an email address of a staff member in my organization. If I try to reference that email address into my To: field, within my Start and Wait for Approval connector, it automatically wraps that section with another Apply to Each 2. Further more, the Assign to: field only takes strings.
To avoid this automatically wrapping, and producing an error, I took the following steps....
I initialized my variable at top level:
Then within my original "Apply to each" wrapper, I set my outputs from previous steps:
Further inside my "Apply to each" wrapper, I append to string variable:
Finally, within my Start and wait for an approval connector, I am assigning the approvers email variable to the Assign to: field.
Everything saves perfectly, but when I run my flow, it errors out halfway stating the following:
The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@{triggerOutputs()?['body/value']}@{variables('approvers email')}' is of type 'String'. The result must be a valid array.
If I am overcomplicating things, I apologize. I simply want the array value of the email address stored in Search for Users V2, to be converted to a string, so that it will work within my Assign To field.
Thanks for any suggestions!
I eventually was able to to get a string conversion from my JSON object relating to the Search for Users v2 connector, by
* Adding my trigger.
* adding a "Apply to Each" action.
* Within here, adding all my base connectors, including the Search for Users v2 connector.
* Adding a Compose connector, to capture the object into an array form.
I spent some time trying to re-construct my process to make it less complex. Now within my workflow area this is what I have....
* The Search for Users V2 connector
* Below that, a Composer (Data Operation) connector so that I can start playing with arrays of data
* Within my expression field for that connector, I made it this far - string(outputs('Search_for_users_(V2)')?['body'])
Now, when I run my flow and see my results, that displays the full array....
[{
"Id":"...",
"AccountEnabled":...,
"BusinessPhones":["..."],
"City":"...",
"Mail":"..."
}]
How can I improve my string expression further to simply get the "Mail" property?
Many thanks!
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2