cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LizAdams
New Member

Error -- 'Apply_to_each' / Power BI

Hi,

Brand new to Power Automate.  I'm trying to use a connection in Power BI to send out an email when the button is pushed on my dashboard. 

The flow is connected a visual with a list of emails and once up and running, should send an email to each person on the list.  

 

I'm getting the following error:


The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@triggerBody()?['entity']?['Power BI values']' is of type 'Null'. The result must be a valid array.

 

Within the email body is dynamic information from the PowerBI visual - like name, number, etc.  There are no null values in my data, so I'm not sure where the 'Null' above is coming from. 


Any help would be greatly appreciated!

 

LizAdams_0-1626973674236.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
DamoBird365
Community Champion
Community Champion

Hi @LizAdams 

 

The null is referring to the "output from previous step" in the apply to each.  Did you create the apply to each or did Flow?  I would stick a compose into your flow above the apply to each and insert the "Power BI Data" dynamic value.  Then run the flow and look back at the history to see what data you are playing with.  

 

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


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

4 REPLIES 4
DamoBird365
Community Champion
Community Champion

Hi @LizAdams 

 

The null is referring to the "output from previous step" in the apply to each.  Did you create the apply to each or did Flow?  I would stick a compose into your flow above the apply to each and insert the "Power BI Data" dynamic value.  Then run the flow and look back at the history to see what data you are playing with.  

 

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


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

Hi @DamoBird365,

THANK YOU!!

Flow added the apply to each automatically.  Adding the compose above worked!  

If it's not too big of an explanation - could you share what that action is doing?  Is it making the PowerBI data a query-able table?  

Hi @LizAdams 

 

Glad you appear sorted, however the compose shouldn't resolve the issue.  It was more a way to demonstrate the data being retrieved by that dynamic value and I was hoping it would highlight to you why the apply to each was failing.  The apply to each will always expect an array ["valueorobject1","valueorobject2","valueorobject3"] etc.

 

If you choose a dynamic value in an action (send email for instance) and it is part of an array, powerautomate will insert an apply to each as it will assume that there are multiple objects and will therefore need to loop through them all.  If you know the array will only contain one object, you can reference it by using the first() expression.

 

I explain some of these concepts in the following video https://youtu.be/6nJSUNh579w

 

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


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

 

@DamoBird365 - thank you, I'll check out your video!  I appreciate your help 😀

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,119)