• Rishi Verma

Runtime Null exception Handling in Power Automate/Flow.

We all have face this error a lot while our flows are running and we are not certain about some attributes we are fetching for processing.


Runtime Null Exception looks like :



The primarily reason for this error during runtime is:

  • Your expression expects its parameter to be an array, a string or boolean, etc but it receives null. 

And since we don't have nullable data types available in power automate we can't really handle this that way. Please support this idea on power automate User voice ideas forum by giving a upvote here : https://powerusers.microsoft.com/t5/Power-Automate-Ideas/Nullable-data-types-should-be-available-in-flows/idi-p/675905


Coming back to the problem, we can currently handle this by giving a empty string value to the runtime flow using coalesce.


coalesce(<<your variable>>, '')

or give a default value when we receive a null value like in my example, I'm using a default GUID for a record which has default changes.


coalesce(variables('ProductID'), '39002a7f-21b8-4502-a37b-9eafaf71a4dc')

You can also set up Monitoring and use Try Catch concept in flows which I have explained in my previous blog : https://www.dynamics365crm.org/post/advance-error-handling-in-flow



I hope you enjoyed reading this article and learned something new!!! If you have any questions or comments about this topic, please let me know in the comments section below. I will also post other useful information for my connections on linkedin about D365 and other Microsoft related news, so we can all learn new things together.


Thank you for reading and until next time!


Rishi

©2019 by Dynamics365 CRM World. Proudly created with Wix.com