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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,559)