Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

How to evaluate if a field / variable is NULL and if so don't use in a "Apply to each" loop?

Good day everyone.  I've got a Flow that I'm using to consume vendor invoices from PDF into Dynamics.  To send the data to Dynamics 365 for Finance and Operations, I am using the connector which has fields, like "Quantity" and "Unit Price".  My issue is this -- if I put my variable for the quantity field but the variable is NULL, that action fails.   This is creating lines in Dynamics so it is in an "Apply to each" loop.  On some invoices, it is picking up garbage lines in between the real lines which don't have the necessary info so it is trying to insert NULL (I am guessing) for those lines.  The real lines are getting processed successfully.


I'm trying to figure out how to skip those garbage lines from being processed?  I'm wondering if there is a formula / expression I can use in the "Apply to each" input that will skip a line if it does not contain a quantity and / or a unit price?

Thank you!  I've been staring at this for days and getting crosseyed.  I imagine there is an easy answer right in front of me but been looking at this too long 🙂



Solution Sage
Solution Sage

Hi @ford_wilkinson ,


Add a condition to check the null Quantity. 





If you like my response, please give it a Thumbs Up.
If this helps, please Accept as solution.



Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (6,312)