Hi - how do I check for the existence of a field in the triggerBody? I cannot check for null or empty as this crashes if the property actually doesnt exist. These do not work @equals(triggerBody()['partnerId'], null) or @empty(triggerBody()['partnerId']) if "partnerId" doesnt exist. I need to check as my HTTP request can occasionally not send the required property.
Solved! Go to Solution.
It does not really work for me
This still fails because genius MS Flow tries to evaluate `body('Start_single_approval')['comments']` expression even if you wrap it with if(contains())
if(contains(body('Start_single_approval'), '"comments": '), body('Start_single_approval')['comments'] ,'')
I also have the same issue where the contains function doesn't work checking for the existance of a property in an array. Exactly the same logic (i.e. within an If statement).
I could not find anything that can properly check for properties to exist...
The only ugly workaround is to create 3 scopes:
Created request for a function that check if property exists: https://powerusers.microsoft.com/t5/Flow-Ideas/Add-an-ability-to-check-if-property-exists-in-an-obje...
Please, upvote if you face the same problem.
I haven't tested it yet, but @xilef suggests using '?' approach. Seems promising to me:
if(empty(body('ApprovalByAnyDirector')?['comments']), 'None', body('ApprovalByAnyDirector')?['comments'])
Check out the News & Announcements to learn more.
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
Check out our new Discover Your Career Path blog post series and get all the details.