cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gmellis1
Level: Powered On

@not(empty(body('Get_mail_tips_for_a_mailbox')?['AutomaticReplies']?['Message'])) returning "The expression is invalid."

I'm trying to implement the validation of an OFF setting in a chain of approvers inboxes to find an approver in office who can be assigned using this site: https://flow.microsoft.com/de-de/blog/canada-mailboxes-aad/

 

It instructs to use "Get mail tips for a mailbox" to send the ping and return any kind of OOF message (among other data) back, and then:

Add a condition. Select edit in advanced more and add an expression like: @not(empty(body('Get_mail_tips_for_a_mailbox')?['AutomaticReplies']?['Message'])). This condition means that the next action will only run if there is an automatic message present.

 

One key note, the Condition sits within a "Do Until" loop. Not sure if that is pertinent, but just in case. 

 

Thanks

 

When i try to use a condition and enter the expression as-is, it returns: "The expression is invalid."

 

That is quite odd given that I set up a separate flow run just "Get mail tips for a mailbox" to validate what data it returns, and validated that Message, does in fact return data when i turn my personal Automatic Replies on. 

 

Any idea why this would return invalid when trying to create a condition as per the blog? Any alternative means? 

 

I've also tried a non-expression condition of "Message does not contain (does not start with, etc.) <div>" and it also doesnt seem to pick up on the presence of "<div>" even thorugh i've alo confirmed it is present in the Message output when i run "Get mail tips for a mailbox." This is critical to an approval workflow i am working on to ensure only an approver for each group that is in office is the first to get the approval request ticket. Any help is appreciated. 

3 REPLIES 3
Highlighted
Super User
Super User

Re: @not(empty(body('Get_mail_tips_for_a_mailbox')?['AutomaticReplies']?['Message'])) returning "The expression is invalid."

You likely have a syntax or formatting issue. If you could provide an expanded screenshot of your Flow and steps, and of any detailed error messages you're receiving we could likely better assist you.

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

v-zhos-msft
Level 10

Re: @not(empty(body('Get_mail_tips_for_a_mailbox')?['AutomaticReplies']?['Message'])) returning "The expression is invalid."

Hi @gmellis1 ,

I have made a flow for your scenario, please check it for a reference.

Expression:

empty(body('Get_mail_tips_for_a_mailbox')?['AutomaticReplies']?['Message']) is not equal to ture

Capture1.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

gmellis1
Level: Powered On

Re: @not(empty(body('Get_mail_tips_for_a_mailbox')?['AutomaticReplies']?['Message'])) returning "The expression is invalid."

So, after hours combing the internet after having tried various options and testing them to no avail, it turns out that the solution is an obscure one unearthed I found not related to this scenario, but the impact of the Advanced option in Condition having been stripped off in favor of the multi-conditional prompt rows. True use the AutomaticReplies not empty expression, you need to use an expression for the value use "is equal to" and make "true" an expression as well, as follows. Then is works as expected. 

Field (as expression): not(empty(body('Get_mail_tips_for_a_mailbox')?['AutomaticReplies']?['Message']))

Qualifier: is equal to

Value (as expression): true

 

Sorry, i can't paste an image. Since about a month or so ago, when i try to paste image, all it gives me is a "Source" field which only seems to be an open string field. The navigation option to get to and select an option is no longer available in the "Insert/edit image" button. 

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

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
Top Kudoed Authors
Users online (5,934)