Reply
Level 8
Posts: 36
Registered: ‎06-30-2016
Accepted Solution

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.


Accepted Solutions
Highlighted
Level 8
Posts: 117
Registered: ‎04-21-2017

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

View solution in original post


All Replies
Community Support Team
Posts: 481
Registered: ‎09-21-2017

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

Level 8
Posts: 36
Registered: ‎06-30-2016

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.

Highlighted
Level 8
Posts: 117
Registered: ‎04-21-2017

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

Level 8
Posts: 36
Registered: ‎06-30-2016

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!