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
Super User
Super User

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
Super User
Super User

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
Super User
Super User

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

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
Super User
Super User

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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Users online (1,055)