Hello all!
I'm writing a Flow that scrapes an API for data that includes a timestamp. If the timestamp is within the last 1 minute, the Flow should post a message as Flow bot to a Teams channel.
The challenge: the timestamp is a 12-digit string formatted yyyymmddhhmm. It's also in U.S. Eastern time. See screenshot below.
The Flow I've written below returns as a success in tests, but it doesn't post to the Teams channel as expected because the timestamp is greater than addMinutes condition always returns false, even though there is data in the API that should result in the condition returning true.
I'm pretty sure this is because the Flow is not reading the timestamp as a properly-formatted time and date in UTC. TBH, I didn't expect it to to test successfully at all — the fact that the condition is reading the string as a time and date at all is a surprise to me.
Because of that, I'm hoping the solution will just be that I need to convert the timestamp to the proper time. I'm hoping I don't have to use compose to separate and rebuild the timestamp.
Either way, I have no experience with converting time or compose.
Any direction or guidance would be appreciated!
Solved! Go to Solution.
Resolved, and a bit easier than I thought.
In the screenshot below...
Compose simply pulls the timestamp. I'm not sure why this step is needed, but without it, the Flow fails.
Compose 2 converts timestamp into a string:
string(outputs('Compose'))
Eastern then pulls timestamp into substrings, re-assembles them as yyyy-mm-dd hh:mm and formats that as time.
formatDateTime(concat(substring(outputs('Compose_2'),0,4),'-',substring(outputs('Compose_2'),4,2),'-',substring(outputs('Compose_2'),6,2),' ',substring(outputs('Compose_2'),8,2),':',substring(outputs('Compose_2'),10,2)),'yyyy-MM-dd hh:mm')
Convert to UTC, and it should work (it's not, but that's another post.)
Thanks for reading this as I worked through the issue!
Getting closer, but this is ugly.
Resolved, and a bit easier than I thought.
In the screenshot below...
Compose simply pulls the timestamp. I'm not sure why this step is needed, but without it, the Flow fails.
Compose 2 converts timestamp into a string:
string(outputs('Compose'))
Eastern then pulls timestamp into substrings, re-assembles them as yyyy-mm-dd hh:mm and formats that as time.
formatDateTime(concat(substring(outputs('Compose_2'),0,4),'-',substring(outputs('Compose_2'),4,2),'-',substring(outputs('Compose_2'),6,2),' ',substring(outputs('Compose_2'),8,2),':',substring(outputs('Compose_2'),10,2)),'yyyy-MM-dd hh:mm')
Convert to UTC, and it should work (it's not, but that's another post.)
Thanks for reading this as I worked through the issue!
Glad that your issue is solved.
Thanks for your posting here and sharing the resolution in the forum as it would be helpful to anyone who encounters similar issues.
Best Regards
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
29 | |
28 | |
27 | |
20 | |
10 |