cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Apply to each failure due to null value from parsing JSON

So I am in the process of trying to build a Flow for Office 365 alerts, one that actually includes the messages and not simply an alert status (those exist out there).  However, the messages portion of the Office 365 Service Communications API, when parsed in Flow, seems to return some Null values in the array.  So whenever I try to run it, I get the error below.  At least, I assume some of the values are null, since I am getting a boatload of output back from MS and it is being parsed.  I have yet to find any kind of definitive answer on how to get the "Apply to each" to simply ignore null values and move on.  Any assistance would be greatly appreciated.  Thank you!

 

Flow.png

2 REPLIES 2
Resident Rockstar
Resident Rockstar

I think you would need to do some clean up before the apply to each.

 

I do not have the exact solution, but i expect you can create an array variable and then add to it for each record in the JSON skipping the ones that are null.

Community Support
Community Support

Hi @JSGarrett,

 

You could try these methods, one is creating a condition to determine the output of Parse JSON whether is null by using empty() function or length() function, if you use the empty(), the condition on the right side should null, if using the length, the right side should be 0; the other is use the Configure after run to select has failed, you could set it at the following action, if the output of Parse JSON is null, the apply to each will failed, and then the following action will continue run:

Annotation 2019-12-09 170557.png

 

Annotation 2019-12-09 170611.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (23,019)