cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MattJ
Helper I
Helper I

Using an expression to create a due date in an email body

Hi All, 

 

Scheduled flow to get items and then send the following email

MattJ_0-1612857177108.png

tried using the following expression to create a due date based on column in the email, keeps throwing the following error

MattJ_1-1612857312177.pngMattJ_2-1612857333953.png

Any help on this would be appreciated

 

thanks 

Matt

1 ACCEPTED SOLUTION

Accepted Solutions
manuelstgomes
Community Champion
Community Champion

Hi @MattJ 

 

Your reasoning is correct, but check if it's empty if it's empty, it will return false in case of null. 

 

Try matching like this:

if(equals(item()?['LCSIIexpiry'],null),'no value',addDays(item()?['LCSIIexpiry'],-90,'yyyy-MM-dd'))

 

If you still want to check for empty, include your iff statement in the "addDays" part of the expression above, and you'll have a formula that can test both.

 

Cheers
Manuel

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
manuelstgomes
Community Champion
Community Champion

Hi @MattJ 

 

The issue is with your formula. I can see you have an "if," but you probably have an addDays function inside. The first parameter that you're providing is empty. Please check what parameter it is and check in the Flow's run if it's really empty? If so, I would recommend another "if" statement to ensure that the addData always has s value.

 

Cheers
Manuel

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi Manuel, 

 

the expression is 

if(empty(item()?['LCSIIexpiry']),'no value', adddays(triggerBody()?['LCSIIexpiry'],-90,'yyyy-MM-dd'))

 

what do i need to change?

 

thanks for the quick response

manuelstgomes
Community Champion
Community Champion

Hi @MattJ 

 

Your reasoning is correct, but check if it's empty if it's empty, it will return false in case of null. 

 

Try matching like this:

if(equals(item()?['LCSIIexpiry'],null),'no value',addDays(item()?['LCSIIexpiry'],-90,'yyyy-MM-dd'))

 

If you still want to check for empty, include your iff statement in the "addDays" part of the expression above, and you'll have a formula that can test both.

 

Cheers
Manuel

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi Manuel, 

 

thanks so much, so if the expression checking to see if column value is null, assigning no value if true, otherwise taking away 90 days?

manuelstgomes
Community Champion
Community Champion

HI @MattJ 

 

Yep, that's it. 😀

 

Cheers
Manuel

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,326)