0

I have a SharePoint list with a proposal date column (SP column name is ProposalDate). I want to manually run a flow that will query the entire list, identify items with a Proposal Date this current month, and send an email on those items. I haven't been successful with the filter query on my Get Items. So I'm hoping someone can help me get this set up. The date format in SP is dd-MM-yyyy. So if an item has a Proposal Date of say 05/15/2024 or 05/30/2024, I want to send an email.

Any help would be appreciated!

Thanks

2
  • What if proposal date is from same month but in the past, do you want to send an email for this case OR send email for future dates from current month only? Example: 3 May 2024. Commented May 10 at 17:34
  • Good question. I would still want the flow to pick up that date and send an email. I'd want it to query the entire list and pull any items with a May proposal Date. Then send an email on those items
    – Chris
    Commented May 10 at 17:40

1 Answer 1

0

In Power Automate, store start and end of current months date and then filter the list in GetItems using those two dates. See the screenshots below

enter image description here startOfMonth(utcNow())

enter image description here

subtractFromTime(addToTime(variables('CurrentMonthStartDT'),1,'month'),1,'second')

enter image description here

enter image description here

Updated the current month's Start and End Date Variables to send just Date values CurrentMonthStartDT: substring(startOfMonth(utcNow()), 0,10)

CurrentMonthEndDT: substring(subtractFromTime(addToTime(variables('CurrentMonthStartDT'),1,'month'),1,'second'), 0, 10)

enter image description here

7
  • Thanks! I ended up with an error though - "unable to process template language expressions in action 'initialize variable 2' inputs at line '0' and column '0': The template language function 'subtractFromTime' expects a timestamp as the first parameter, and interval as the second parameter, a time unit as the third parameter, and an optional format string as the fourth parameter. The function was invoked with '1' parameter(s)
    – Chris
    Commented May 10 at 18:11
  • Can you post your expression? I think you have some parenthesis issue. Or check here how this function to be added to expressions: learn.microsoft.com/en-us/azure/logic-apps/… Commented May 10 at 18:31
  • Also, check the variable name in your expresssion subtractFromTime(addToTime(variables('CurrentMonthStartDT'),1,'month'),1,'second') Commented May 10 at 18:33
  • Okay you were right that I had a parenthesis issue. Fixed it and ran it again. Didn't receive an error on the two Compose actions, BUT I did get an error on my Get Items filter query. My Due Date column is date only, so this is the error I got: "The expression "ProposedDate gt '2024-05-01T00:00:00.0000000Z' and ProposedDate It '2024-05-31T23:59:590000000Z" is not valid.
    – Chris
    Commented May 10 at 18:51
  • You can use substring() function to just get the date values and store in the same variables. see the updated expressions. Mine date time field is set to show just Date, but stilled worked Commented May 10 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.