cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thomas
Level 8

Empty object/array is not Empty

Hi,

 

I got a problem with an empty array, which is not passing my @empty() Check. And due to that, it causes an error sending a push notification to an empty receipient.

 

Get the Attendees from an appointment:

 

Empty Attendees 1.png

 

There are none, but I have to remove myself, if I´d be there:

(Filter: item() equals MyUser.Email)

Empty Attendees 2.png

It somehow seems, that the Filter change the output from noting, to an empty array [""], to an empty object []

I check that and want to abort the Flow, which does not happen:

Empty Attendees 3.png

It passes with "false".

 

It defenitely worked in the past! I´vent toucht that for a while and now it gave me an error on the function, because of the empty object.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Empty object/array is not Empty

Hi @Thomas.

 

You can use the length instead empty.

 

put this in your condiction:

 

@greater(length(outputs('Filter_Attendees_only')),0)

Hope this helps,

 

Best Regards,

 

Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Empty object/array is not Empty

Hi @Thomas,

 

Could you please share a screenshot of your flow’s configuration?

Do you want to get the Attendees of appointment of Outlook 365?

Further, could you please show a bit more about the formula of your “Get Attendees” action?

The input array of your “Filter array” action is not an empty array, it has one element which is an empty string, so the result that your @empty() function returned is false.

 

Please check if there is something wrong with the formula of your “Get Attendees” action. Besides, also please check if the appointment has invited other Attendees.

 

I have made a test on my side and the flow works well. Please take a try with the following workaround:

  • Add “When a new event is created (V2)” trigger.
  • Add “Compose” action, Input set to the following formula:

 

split(triggerBody()?['RequiredAttendees'],';')

 

  • Add “Filter array” action, From set to output of “Compose” action. Click “Edit in advanced mode”, type the following formula:

 

@and(not(equals(item(), 'Test1@Wicren.onmicrosoft.com')),not(equals(item(), '')))

 

  • Add “Apply to each”, input parameter set to output of “Filter array” action.
  • Within “Apply to each”, add “Send an email” action. To field set to following formula:
item()

Image reference:10.JPG

 

11.JPG

The flow works successfully as below:12.JPG

 

13.JPG

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thomas
Level 8

Re: Empty object/array is not Empty

Hello Kris,

 

thanks a lot for your detailed answer!

 

As you suggest, I´m using the "Get calendar appointments (V2)" (not the "new Event is created", but also V2).

My "Get Attendees" looks like that:

 

 

replace(toLower(concat(first(body('Clean_up_events'))['RequiredAttendees'], first(body('Clean_up_events'))['OptionalAttendees'])), toLower(concat(body('My_Profil')?['Mail'], ';')), '')

Which might be the cause of the empty array entry. But it is intended! I´d like to inform all attandees in which room the appointment will be. But only attandees from my company and not me (because I´m running the flow and know where I am).

 

Clean_up_events is another filter, which removes "all day" appointments.

 

But I already did it like you within my filter:

 

@and(endswith(item(), '@xxx.de'),not(equals(item(), '')))

 

And the result is still the same. My check if the Filter-Result is empty, wont cancel the flow. It says "false" and runs into the next step, which causes the error.

Also checking the item for empty does not work in the Filter:

@and(endswith(item(), '@xxx.de'),not(empty(item())))

 

Empty Attendees 4.png

 

If there is an attendee, whos inside my company and is not me, it works! He gets an email with the current room.

Super User
Super User

Re: Empty object/array is not Empty

Hi @Thomas.

 

You can use the length instead empty.

 

put this in your condiction:

 

@greater(length(outputs('Filter_Attendees_only')),0)

Hope this helps,

 

Best Regards,

 

Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


View solution in original post

Highlighted
Thomas
Level 8

Re: Empty object/array is not Empty

@gamoraescombining both (in the end all three), did the deal!

 

@and(and(endswith(item(), '@xxx.de'),not(empty(item()))), greater(length(item()),0))

Thank you!

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Users online (5,960)