Hi All,
Is it possible to add a message at the end of a flow to say the duration time of the flow?
For example the message might say,
" X Flow took 3 mins to complete"
Thank you @annetoal . This very useful
The simplest way might be to store the time at the beginning and again at end of the Flow, then subtract the finish time from the start time. Here's an example that calculates the tenths of a second between start and end of execution and then sends a mail:
I used compose actions to illustrate the basic concepts. You might find other actions are better choices in your Flow.
The Start and Finish actions:
ticks(utcNow())
The Compose action represents where you would put all your Flow steps.
The tenths of a second compose:
div(sub(outputs('finish'),outputs('start')),1000000)
Then the Send an email action takes the output from the tenths of a second compose action
workflow()?['tags']?['flowDisplayName'] took outputs('tenths_of_a_second') tenths of a second to execute.
and puts it into a mail.
I used tenths of a second here because this is a short Flow and it's not going to take long to execute. You might find other intervals more suitable.
To learn how to calculate other intervals (day, week, month, etc.), read this:
Solved: how to get difference between two dates in flow - Power Platform Community (microsoft.com)
If this helped, please mark it as a Solution.
Anne