Tip #1213: When you pushed that button simplified

In tip #1213 we walked you through a long winded way finding out where and when the Flow button was pushed. It involved using lattitude and longitude of the user’s location and calling Bing Maps API.

As it turns out, if you are only after the local time, there is a much simpler method. When a flow is invoked using manual button, trigger tokens contain, among other values, local date and time at the location where the button was invoked. These values are accessible using the following expressions:

  • Date as triggerBody()['key-button-date']
  • Timestamp as triggerBody()['key-button-timestamp']

The entire brouhaha can now be reduced to:

Flow telling the local time

The only gotcha is that the property key-button-timestamp does not exist when the flow is run from the browser, it is only available on a mobile device. When testing, do at least a single run using a mobile device and then re-use this test run data in subsequent testing.

(Cover photo by Luke Chesser on Unsplash)

Leave a Reply

Your email address will not be published. Required fields are marked *