I have a custom connector. For simplicity's sake, let's say a request is of the format
"foo" : 5,
"optional_bar" : 3
optional_bar is optional, so this will work
But this will not work
"optional_bar" : null
This is a feature of the API I am communicating with, not Power Automate. So here is my question.
Sometimes optional_bar will be null, sometimes it will contain a value. How can I stop the custom connector / Power Automate including any property whose value is null?
Yes I could use a conditional to check if its null, and then call an action with or without that field filled in. However my example is simplified - in real life there may be many many properties with nulls and including all permutations would be difficult.
Solved! Go to Solution.
Hi @abm. I have built a custom connector. It works fine. The problem is that in the Flow action if I leave the optional parameter blank it works fine (the property is omited from the request), but if I have a dynamic value in that field that either returns NULL, the connector fails (the property is not ommitted from the request). How can I get the custom connector to omit a property if it resolves as blank?
@abmso I could have a Condition before, and if its a null it runs one action that doesn't include the optional parameter, and if the parameter is not null it runs a different action that does include the optional parameter. Only... I have about 5 different parameters that might be null or not null, which would require me to have a nesting series of if statements with 2^5 = 32 different permutations.
That is indeed a clever and dirty solution.
It doesn't work in my exact context because the foo and optional_bar have to be filled in as separate fields on the custom connector, so I can't just pass it the entire object with the optional_bar ommitted.
Buuut, I have taken inspiration from this solution to rework the custom connector so it just accepts an object with all the fields in it, in which case your solution works. Thanks!
I do view this as an ongoing problem in Power Automate. Its not the first time I've had this problem, and it's happened for me on actions which aren't custom connectors and I don't have the luxury of the method above. So if anyone has a solution to that, you're welcome to post even though @abm has solved my specific problem.
Check out the new Process Advisor community forum board!
Check out new user group experience and if you are a leader please create your group
On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks
Check out how to claim yours today!