AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.12.2018, 14:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
crmtipoftheday: Tip #1203: When and where you pushed that button
Источник: https://crmtipoftheday.com/1203/when...d-that-button/
==============

There is a time in life of every developer when they have to clench their fists and… start learning Flow. Today’s topic – localized date time.

Flows run on a… in a …. wherever Flows run. Time is UTC in that world. So how does one bring the concept of a time, local to the user, into that world?

Let’s start with a simple case of a manual flow, a.k.a. push a button on your mobile device. Here’s the challenge – whatever button passes to the flow, including a timestamp, is in UTC. Challenge accepted.
  1. Read about trigger tokens, all device goodness is there but, as I said, timestamp is UTC.
  2. Latitude and longitude are also among trigger tokens and available when you run a button flow

    Note: if you are using these values, your phone mobile device must have location services enabled otherwise:

    Ok, now that we have latitude and longitude, we need to convert them into the time zone information.
  3. In your Azure account, add Bing Maps API for Enterprise (don’t worry, it’s free up to 10,000 transactions per month). Don’t have Azure account and really don’t want one? You can still use https://www.bingmapsportal.com/ for a time being to register an account and get yourself an API key. Check the usage rights because copyright message is very explicit:
    This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.

  4. The API we are after is Find Time Zone and the call looks like this:
  5. Use Postman to get a sample response and then use Parse JSON action to extract values from the API response. The coveted value is
    body('parse_json_action')['resourceSets'][0]['resources'][0].timeZone.genericName
    (Don’t ask)
  6. Convert time zone action will give us the conversion we are after (button is kind to give us the timestamp when it was pushed)
  7. Finally, we can call a location API to get the place or neighborhood (full address is available as a trigger token) and then send a notification to ourselves telling us what was the time and where we pushed that button
The results are awesome:



Afterthoughts

I noticed that all posts about Flow are full of images. I fell into that trap too, it seems, but for the last time. Instead, download the flow (sans the keys) here and import into your environment to play with it.

(Cover photo by Ehimetalor Unuabona on Unsplash)



Источник: https://crmtipoftheday.com/1203/when...d-that-button/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 12:20.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.