cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gardnerlhwrc
Helper II
Helper II

Adding multiple SP list items to HTML with conditions

Hey All, 

 

I have a flow thats working but I want to put all the items that meet the condition into a table rather than multiple emails. 

 

Heres the flow..Now the slight oddness here is that the flow errors but still send the emails at the moment. but not sure if the error is stopping the table from working.

gardnerlhwrc_0-1646992921880.png

Left

formatDateTime(item()['PermiteEndDate'],'dd-MM-yyyy')

Right

addDays(utcNow(),1,'dd-MM-yyyy')

 

Tried adding Select > Create HTML table after 'Get Items' and after the condition but no joy on either. 

 

Thanks  L

1 ACCEPTED SOLUTION

Accepted Solutions
fchopo
Super User
Super User

Hi @gardnerlhwrc 

The expression should be: 

PermiteEndDate eq 'addDays(utcNow(),1,'yyyy-MM-dd')'

Please, pay attention to the single quote before and after the "addDays" expression.

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

9 REPLIES 9
fchopo
Super User
Super User

Hi @gardnerlhwrc 

You can use the condition in the filter query expression on the get items action:

devices-flow.png

 

After that, you can create the HTML table and send it by email.

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
gardnerlhwrc
Helper II
Helper II

Oh great, so the expression in the filter would look something like this? Please excuse the spoon feeding here. i'm rather new to this. 

formatDateTime(item()['PermiteEndDate'],'dd-MM-yyyy') eq addDays(utcNow(),1,'dd-MM-yyyy')
 
Thanks L
 
fchopo
Super User
Super User

Exactly, using the "expression" for both condiitons.

Have a look here: Solved: Get Items Filter Query - Power Platform Community (microsoft.com)

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
gardnerlhwrc
Helper II
Helper II

So hitting the similar error as I was before which looks like its stopping the get items. 

 

gardnerlhwrc_0-1646994830621.png

Then i get this error 

Unable to process template language expressions in action 'Get_items' inputs at line '0' and column '0': 'The template language expression 'formatDateTime(item()['PermiteEndDate'],'yyyy-MM-dd')' cannot be evaluated because property 'PermiteEndDate' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

 

Now that column in 100% in my list and in the old flow it would work. (changed format of the date to see if that helped.) Just not sure because its erroring at the 'Get Items' step is why its not working.

 

fchopo
Super User
Super User

Hi @gardnerlhwrc 

The expression should be: 

PermiteEndDate eq 'addDays(utcNow(),1,'yyyy-MM-dd')'

Please, pay attention to the single quote before and after the "addDays" expression.

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
gardnerlhwrc
Helper II
Helper II

You my friend are an absolute legend! If you was here I would buy you a beer or which ever beverage you prefer. 

 

Thank you very much. Have a good Friday and weekend.

gardnerlhwrc
Helper II
Helper II

@fchopo, I feel so bad to come back to you again. but 1 last question I promise. 

So I have exactly the same flow but I'm a bit dumb so when Due date or Expiry date is a Monday i want email to be sent on Friday. Can I use the Get Items filter to help with this. I was thinking of something like this.

 

PermiteEndDate eq '@{addDays(utcNow(),1,'yyyy-MM-dd')}' and '@{dayofWeek(utcNow())}' eq 1

 

gardnerlhwrc_1-1646998727820.png

 

Was merely wondering if the filter allows for 'and' expression. 

 

Thanks L

gardnerlhwrc
Helper II
Helper II

Dont worry I sorted it. Needed to use dayOfWeek(utcNow()) as a control rather than in the filter query

 

gardnerlhwrc_0-1647009666070.png

 

gardnerlhwrc
Helper II
Helper II

I guess even better solution now I think of it would of been to just to allow this flow to run on Fridays only, then no need for extra control....well there's 3 hours I wont get back...

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.

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,154)