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 on demand sessions that are available now!
ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.
Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!