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

Using manual trigger dates in condition

Hi

I am very new to flow and I'm trying to create a flow that requests for a [Start Date] and [End Date] when triggered.

Then I wish to use those dates in conditions so that I can populate a database with the document properties (from Sharepoint) where the document date is between the two dates.

 

I have been trying to use the following condition, but it isn't identifying any documents that fulfil the criteria even though I know there are some that do. 

 

@and(@greateror equals(items('Apply_to_each')?['Document_x0020_Date'], triggerbody()?['Start Date'], ''), @lessorequals(items('Apply_to_each')?['Document_x0020_Date'], triggerbody()?[End Date'], ''))

 

Any help with this would be very much apprecaited. 

 

TIA

2 REPLIES 2
Community Support Team
Community Support Team

Re: Using manual trigger dates in condition

Hi @Back2Basics,

 

What’s the trigger in your flow? How do you input Start date and End date when triggered?

To test this issue, I created a flow with the Button trigger, input Start date and End date using two text fields.

Then get file properties from a document library.

In the condition, input the following code:

@and(greaterorequals(items('Apply_to_each')?['Date'], triggerBody()['text']),lessorequals(items('Apply_to_each')?['Date'], triggerBody()['text_1']))

Note: triggerBody()['text'] is the Start date, triggerBody()['text_1'] is the End date.

The code works fine and documents within the two dates will be filtered out.

1.PNG

Please take it for a reference and try again on your side.

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Back2Basics
Level: Powered On

Re: Using manual trigger dates in condition

Thanks Mabel Mao.

 

Yes, I have set up a button trigger  to get a user to input the start and end dates as you have done.

 

Thank you for the condtition code. I have used this and updated 'Date' to 'Document Date' as well as 'text' and 'text_1'. It works in terms of it being a workable condition, but I still get no returns, despite knowing that there are documents that fit this criteria. I thought it might be the date format that I'm using, but i've tried various formats and it's not working - do you know what format I should use for the 'start date' and 'end date' texts? 

 

I have tried: dd/mm/yyyy, mm/dd/yyyy, yyyy-mm-dd

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,130)