web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apply to each Expressi...
Power Automate
Unanswered

Apply to each Expression Evaluation Failed when building string

(0) ShareShare
ReportReport
Posted on by

Apply to each Expression Evaluation Failed when building email string

Initialize varialbes: GroupID (int), strEmailRecipient (str)

1.png

Note the GroupID is used in the () to quesry the correct sitegroups and $select Email of all members. And the HTTP requests returns green.2.png

 

3.png

 

How the 'Parse JSON' step is configured:4.png

 

Which runs successfully during test:5.png

 

Here is how the 'Apply to each' is configured to build a string of email addresses:6.png

 

And the error message during test:7.png

 

I've tried adding ?[0]?['Email'] and error becomes:

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@{body('Parse_JSON')?['d']?['results']}?[0]?['Email']' is of type 'String'. The result must be a valid array.

Same results when I add item()? before the email in the value 'Append to string variable'.

If only there was a step to query SPO groups for emails... but La..

Thanks in advance!

 

 

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,143 on at

    Hi @Anonymous 

     

    After the send an http request action which returns the users within the group

     

    Run a for loop with following expression

    body('Send_an_HTTP_request_to_SharePoint')?['value']

     

    within loop

    append to string variable

    item()?['Email']

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    You pointed me the right direction! And my sanity thanks you @RezaDorrani!

    So I removed the parse json step.

    Added the 'apply to each' directly after the 'send an http request to SharePoint' and  

    manually added the following to the 'select an output..' through the expression builder:

     

    body('Send_an_HTTP_request_to_SharePoint')?['value']

     

    then added the following to the 'append to string variable' through the expression builder:

     

    items('Apply_to_each')?['Email']

     

    to the value and BAM! Bob's your uncle. Works like a champ.

  • RezaDorrani Profile Picture
    12,143 on at

    Hi @Anonymous 

     

    Glad it worked out for you

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • vnguyen1 Profile Picture
    40 on at

    @RezaDorrani 

    https://powerusers.microsoft.com/t5/Using-Flows/how-to-output-string-value-out-of-json-parse/td-p/837955

    i have looked into your solution for this flow issue. somehow i could not apply to my flow. do you have any suggestion ? please advice. Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard