This article is part of the Working with Power Automate series I am writing on my experiences working with the Power Automate, which is part of the Power Platform from Microsoft. I also have a related series of articles on Power Automate with Microsoft Dynamics 365 BC.
I was working on a flow a while ago and was using the Microsoft Dynamics 365 Business Central “Find record V3” action and needed to select invoices posted over 30 days ago. To do this I needed to calculate the date 30 days before the present date.
I did some digging and found the required function, which, somewhat counter-intuitively, is called addDays
:
The function requires three parameters:
- timestamp – date to base the calculation on; I used the function
utcNow()
to get current date/time. - days – the number of days to add or, if a negative number, the number of days to subtract
- format – format for the date, which I always use the ISO date format for as this ensures that both UK and US date systens will correctly compare (UK uses dd-MM-yyyy whereas the US uses MM-dd-yyyy).
addDays(utcNow(), -30, 'yyyy-MM-dd')
The expression returns the current date minus 30 allowing me to use this in the filter to only selected invoices older than this date.
Working with Power Automate
What should we write about next?
If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.