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

New to Flow, want to send an email with multiple conditions from a SharePoint list

Hi everyone,

 

I'm the first to admit that I've been banging my head with something that I know if I open up SPD, I can do this in 10 minutes.

 

I have a task list. 

Assigned to Name, status, Anticipated Completion date

John.Smith@contoso.com, In Progress, October 18, 2018

I want to send an email if the Anticipated Completion date = today and Status is not equal to completed.  I want the email to go to the assigned to person.

 

Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: New to Flow, want to send an email with multiple conditions from a SharePoint list

 

Hi @smorley,

 

The error message told that the value from the expression triggerBody()?['Completion_x0020_Date_x00'] is empty, please make sure the Completion Date column is not empty.

 

And if the Completion Date column's name is Completion Date, the expression of Completion Date column should be:triggerBody()?['Completion_x0020_Date']

 

If the Assigned To name is a person/group field, Please choose the Assigned To Email dynamic content of the trigger in the To field of send an email action.

 

If the Status is choice field, the expression of Status column value should be:

triggerBody()?['status']?['Value']

 

If the available Choice value of Status is Complete, then the expression to check if the Status Value should be:

 

not(equals(triggerBody()?['status']?['Value'], 'Completed'))

 

 

 

And the expresssion in the Condition should be:

 

@and(equals(formatDateTime(triggerBody()?['Completion_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd')),not(equals(triggerBody()?['status']?['Value'], 'Completed')))

 

Best regards,

Alice

 

7 REPLIES 7
Community Support Team
Community Support Team

Re: New to Flow, want to send an email with multiple conditions from a SharePoint list

Hi @smorley,

 

Could you please share a more details about the type of Assigned to Name, status, Anticipated Completion date column in the sharepoint list?

 

I have made a test on my side to create a Assigned to Name column, a status column with a single line of text type , and a Anticipated Completion date column with a date type in the sharepoint list.

 

If the Assigned to Name column, status column with a single line of text type, and the Anticipated Completion date column with a date type in the sharepoint list,please refer to screenshot below to create the flow:

Capture.PNG

The expression in the condition as below:

@and(equals(formatDateTime(triggerBody()?['Anticipated_x0020_Completion_x00'], 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd')),not(equals(triggerBody()?['status'], 'completed')))

The flow would run successfully as below:

Capture.PNG

 

Please let me know if your problem could be solved or share more details about the type of the columns so we would try to provide a proper workaround for you.

 

Best regards,

Alice

 

 

 

smorley
Level: Powered On

Re: New to Flow, want to send an email with multiple conditions from a SharePoint list

Hi @v-yuazh-msft

The Assigned To name is a person/group field, Completion Date is date/time field, Status is choice field.  

 

I did try your solution, but Flow didn't like the formatDateTime part of your condition.  

This is what I put in:

@and(equals(formatDateTime(triggerBody()?['Completion_x0020_Date_x00'], 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd')),not(equals(triggerBody()?['status'], 'Completed')))

 

The flow fails, here is the error message: 

 
InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2527': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.
Community Support Team
Community Support Team

Re: New to Flow, want to send an email with multiple conditions from a SharePoint list

Hi @smorley,

 

The error message told that the value from the expression triggerBody()?['Completion_x0020_Date_x00'] is empty, please make sure the Completion Date column is not empty.

 

And if the Completion Date column's name is Completion Date, the expression of Completion Date column should be:triggerBody()?['Completion_x0020_Date']

 

If the Assigned To name is a person/group field, Please choose the Assigned To Email dynamic content of the trigger in the To field of send an email action.

 

If the Status is choice field, the expression of Status column value should be:

triggerBody()?['status']?['Value']

 

If the available Choice value of Status is Complete, then the expression to check if the Status Value should be:

not(equals(triggerBody()?['status']?['Value'], 'Completed'))

 

And the expresssion in the Condition should be:

@and(equals(formatDateTime(triggerBody()?['Completion_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd')),not(equals(triggerBody()?['status']?['Value'], 'Completed')))

Best regards,

Alice

 

 

Community Support Team
Community Support Team

Re: New to Flow, want to send an email with multiple conditions from a SharePoint list

 

Hi @smorley,

 

The error message told that the value from the expression triggerBody()?['Completion_x0020_Date_x00'] is empty, please make sure the Completion Date column is not empty.

 

And if the Completion Date column's name is Completion Date, the expression of Completion Date column should be:triggerBody()?['Completion_x0020_Date']

 

If the Assigned To name is a person/group field, Please choose the Assigned To Email dynamic content of the trigger in the To field of send an email action.

 

If the Status is choice field, the expression of Status column value should be:

triggerBody()?['status']?['Value']

 

If the available Choice value of Status is Complete, then the expression to check if the Status Value should be:

 

not(equals(triggerBody()?['status']?['Value'], 'Completed'))

 

 

 

And the expresssion in the Condition should be:

 

@and(equals(formatDateTime(triggerBody()?['Completion_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd')),not(equals(triggerBody()?['status']?['Value'], 'Completed')))

 

Best regards,

Alice

 

VikVerma
Level: Powered On

Re: New to Flow, want to send an email with multiple conditions from a SharePoint list

Do you want to send an email when a new item gets created with those conditions?

It's definitely doable. You need a condition block with and(condition 1, condition 2) using required list columns.
smorley
Level: Powered On

Re: New to Flow, want to send an email with multiple conditions from a SharePoint list

Sorry @v-yuazh-msft,  I'm still getting the error of: 

 
InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2527': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.
 
I did use your syntax: 
@and(equals(formatDateTime(triggerBody()?['Completion_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd')),not(equals(triggerBody()?['status']?['Value'], 'Completed')))
 
Here is a screen shot of the item I'm testing with: 
flowerror.jpg
smorley
Level: Powered On

Re: New to Flow, want to send an email with multiple conditions from a SharePoint list

Hold everything!

@v-yuazh-msftAlice, I think I outsmarted myself.

 

The Completed date field.  I'm reasonably sure that I must have renamed it, and that was causing the error.  I created a new field called "Completed", and changed the expression to reflect that field, and it worked. 

Thanks so much for all your help.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 140 members 4,633 guests
Recent signins:
Please welcome our newest community members: