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 / Error: Array elements ...
Power Automate
Unanswered

Error: Array elements can only be selected using an integer index

(0) ShareShare
ReportReport
Posted on by 27

Hi All,

I am trying to create a flow where I want to send an adaptive card to each o365 member listed in my teams group. While creating the below flow, I am getting an error saying, "Unable to process template language expressions for action 'Apply_to_each' at line '0' and column '0': 'The template language expression 'body('LGM')?['value']?['mail']?[0]' cannot be evaluated because property 'mail' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'."

 

I am getting 3 JSONs where I want to extract the mail from individual body, as shown in my screenshot(arrowed in red). How do i do that?

 

Attached are the screenshots, can you let me know where do I need to correct the expression?

 

Thanks for your help.

Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,484 on at

    Hey @Ashish2605 

     

    Your expression here is a little incorrect.

     

    The expression should be:

     

    body('LGM')?['value']?[0]?['mail']

     

    Actually here value is your array and after your array you will have to put your iteration and then the field you want.

     

    I hope this helps 🙂

  • Ashish2605 Profile Picture
    27 on at

    Hi @Sundeep_Malik ,

     

    Thanks for the suggestion, however I am getting the below error now

    The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('LGM')?['value']?[0]?['mail']' is of type 'String'. The result must be a valid array.

    How do i convert this string to array? 

  • Sundeep_Malik Profile Picture
    6,484 on at

    @Ashish2605 

     

    Oh instead of this just pass the value expression in apply to each.

     

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

     

    And then inside apply to each you can use adaptive card action and use email there.

  • Fars4 Profile Picture
    7 on at

    You saved me,

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard