{"id":33080,"date":"2022-11-17T14:19:28","date_gmt":"2022-11-17T08:49:28","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=33080"},"modified":"2022-11-17T14:19:28","modified_gmt":"2022-11-17T08:49:28","slug":"set-timezone-format-field-based-on-account-location-in-microsoft-dynamics-365","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2022\/11\/set-timezone-format-field-based-on-account-location-in-microsoft-dynamics-365\/","title":{"rendered":"Set Timezone format field based on Account Location in Microsoft Dynamics 365"},"content":{"rendered":"<p>In Dynamics 365, we have the flexibility to store data of a variety of types such as text, number, lookups, options, etc. Time Zone is a type of format for <strong>Whole Number<\/strong>, which allows the user to store the Time zone information of a particular record in CRM.<\/p>\n<p>The screenshot below explains the same<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33089\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/1Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1163\" height=\"779\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/1Map-Dynamics-365.jpeg 1163w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/1Map-Dynamics-365-300x201.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/1Map-Dynamics-365-1024x686.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/1Map-Dynamics-365-768x514.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/1Map-Dynamics-365-660x442.jpeg 660w\" sizes=\"(max-width: 1163px) 100vw, 1163px\" \/><\/p>\n<p>In this blog, we will consider a business requirement where we have to set the <strong>Time Zone<\/strong> field value on an <strong>Account<\/strong> based on the <strong>Latitude<\/strong> and <strong>Longitude<\/strong> values dynamically when the Account record is created in CRM.<\/p>\n<p>Let\u2019s walk through the steps we need to perform to achieve the above requirement:<\/p>\n<p>1. Navigate to <a href=\"https:\/\/make.powerapps.com\" target=\"_blank\" rel=\"noopener\"><strong>https:\/\/make.powerapps.com<\/strong><\/a> and create a custom field \u201c<strong>Account Time Zone<\/strong>\u201d with data type as <strong>Whole Number<\/strong> having the format as <strong>TimeZone<\/strong>. Add the field on the form as well so that the user can see the value in the field.<\/p>\n<p>2. We will create a Power Automate Flow to get the timezone from Location coordinates and set the TimeZone field value on the Account record. Navigate to the appropriate solution and create a <strong>Power Automate flow<\/strong> with trigger action as \u201c<strong>Add a Row<\/strong>\u201d.<\/p>\n<p>Refer the screenshot below-<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33088\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/2Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1306\" height=\"539\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/2Map-Dynamics-365.jpeg 1306w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/2Map-Dynamics-365-300x124.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/2Map-Dynamics-365-1024x423.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/2Map-Dynamics-365-768x317.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/2Map-Dynamics-365-660x272.jpeg 660w\" sizes=\"(max-width: 1306px) 100vw, 1306px\" \/><\/p>\n<p>3. Add HTTP connector to get the Time Zone from Latitude and Longitude field value of Account.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33087\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/3Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1307\" height=\"625\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/3Map-Dynamics-365.jpeg 1307w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/3Map-Dynamics-365-300x143.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/3Map-Dynamics-365-1024x490.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/3Map-Dynamics-365-768x367.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/3Map-Dynamics-365-660x316.jpeg 660w\" sizes=\"(max-width: 1307px) 100vw, 1307px\" \/><\/p>\n<p>As shown in the screenshot below, add a URI as follows:<\/p>\n<p>https:\/\/dev.virtualearth.net\/REST\/v1\/TimeZone\/@{triggerOutputs()?[&#8216;body\/address1_latitude&#8217;]},@{triggerOutputs()?[&#8216;body\/address1_longitude&#8217;]}?key={BingMapKey}<\/p>\n<ul>\n<li><strong>@{triggerOutputs()?[&#8216;body\/address1_latitude&#8217;]}<\/strong> : will be <strong>address1_latitude<\/strong> field value of the Account.<\/li>\n<li><strong>@{triggerOutputs()?[&#8216;body\/ address1_longitude &#8216;]}<\/strong> : will be <strong>address1_longitude<\/strong> field value of the Account.<\/li>\n<\/ul>\n<p>4. Next step will be getting <strong>Response<\/strong> from the <strong>HTTP<\/strong> body as shown in the below screenshot.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33086\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/4Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1293\" height=\"751\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/4Map-Dynamics-365.jpeg 1293w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/4Map-Dynamics-365-300x174.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/4Map-Dynamics-365-1024x595.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/4Map-Dynamics-365-768x446.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/4Map-Dynamics-365-660x383.jpeg 660w\" sizes=\"(max-width: 1293px) 100vw, 1293px\" \/><\/p>\n<p>5. Now add a step to Initialize the Variable with the below expression value:<\/p>\n<p>body(&#8216;Http&#8217;)?.resourceSets[0]?.resources[0]?.timeZone.genericName<\/p>\n<p>This expression will get the <strong>Generic Name<\/strong> of the Time Zone as follows-<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33085\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/5Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1294\" height=\"369\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/5Map-Dynamics-365.jpeg 1294w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/5Map-Dynamics-365-300x86.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/5Map-Dynamics-365-1024x292.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/5Map-Dynamics-365-768x219.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/5Map-Dynamics-365-660x188.jpeg 660w\" sizes=\"(max-width: 1294px) 100vw, 1294px\" \/><\/p>\n<p>6. Now we will retrieve the <strong>Time Zone Definitions<\/strong> record based on the <strong>Generic Name<\/strong> with the \u201c<strong>Time Zone Code<\/strong>\u201d column.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33084\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/6Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1347\" height=\"701\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/6Map-Dynamics-365.jpeg 1347w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/6Map-Dynamics-365-300x156.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/6Map-Dynamics-365-1024x533.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/6Map-Dynamics-365-768x400.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/6Map-Dynamics-365-660x343.jpeg 660w\" sizes=\"(max-width: 1347px) 100vw, 1347px\" \/><\/p>\n<ul>\n<li><strong>Select Columns<\/strong>: timezonecode<\/li>\n<li><strong>Filter rows<\/strong>: standardname eq &#8216;@{variables(&#8216;Time Zone Name&#8217;)}&#8217;<\/li>\n<\/ul>\n<p>7. Once we get the Timezone code, we will set the appropriate Time Zone on the Account within the \u201c<strong>Account Time Zone<\/strong>\u201d column.<\/p>\n<p><em>Note that the <strong>Time Zone<\/strong> format field stores an integer value that same as that of the <strong>Time Zone Code<\/strong> from the OOB <strong>Time Zone Definitions<\/strong> table in CRM.<\/em><\/p>\n<p><em>\u00a0<\/em>So, will add a step to <strong>Update an Account<\/strong> with <strong>Account Time Zone<\/strong> column = <strong>Time Zone Code<\/strong> retrieved from the previous step.<\/p>\n<p>Refer to the below screenshot<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33083\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/7Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1313\" height=\"743\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/7Map-Dynamics-365.jpeg 1313w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/7Map-Dynamics-365-300x170.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/7Map-Dynamics-365-1024x579.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/7Map-Dynamics-365-768x435.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/7Map-Dynamics-365-660x373.jpeg 660w\" sizes=\"(max-width: 1313px) 100vw, 1313px\" \/><\/p>\n<p>8. Save the Flow and now, we can test the flow by creating an Account record with the appropriate Latitude and Longitude.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33082\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/8Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1439\" height=\"735\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/8Map-Dynamics-365.jpeg 1439w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/8Map-Dynamics-365-300x153.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/8Map-Dynamics-365-1024x523.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/8Map-Dynamics-365-768x392.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/8Map-Dynamics-365-660x337.jpeg 660w\" sizes=\"(max-width: 1439px) 100vw, 1439px\" \/><\/p>\n<p>9. Refresh the Account form as the <strong>Power Automate Flow<\/strong> will be triggered in the background and will take some time to complete the process. Now we can see the <strong>Time Zone <\/strong>has been set on the Account.<\/p>\n<p>The screenshot below supports the same-<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33081\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/9Map-Dynamics-365.jpeg\" alt=\"Map Dynamics 365\" width=\"1351\" height=\"709\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/9Map-Dynamics-365.jpeg 1351w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/9Map-Dynamics-365-300x157.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/9Map-Dynamics-365-1024x537.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/9Map-Dynamics-365-768x403.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/9Map-Dynamics-365-660x346.jpeg 660w\" sizes=\"(max-width: 1351px) 100vw, 1351px\" \/><\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>In this way, we can set the dynamic value in the <strong>Time Zone<\/strong> based on the <strong>Time Zone Code<\/strong> retrieved using latitude and longitude attributes.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/2022\/11\/3-key-microsoft-dynamics-365-crm-implementation-essentials-addressed\/\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone size-full wp-image-33091\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/InoLink.png\" alt=\"\" width=\"800\" height=\"200\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/InoLink.png 800w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/InoLink-300x75.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/InoLink-768x192.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/11\/InoLink-660x165.png 660w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Dynamics 365, we have the flexibility to store data of a variety of types such as text, number, lookups, options, etc. Time Zone is a type of format for Whole Number, which allows the user to store the Time zone information of a particular record in CRM. The screenshot below explains the same In\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2022\/11\/set-timezone-format-field-based-on-account-location-in-microsoft-dynamics-365\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[16,18,2361],"tags":[],"class_list":["post-33080","post","type-post","status-publish","format-standard","hentry","category-dynamics-365","category-dynamics-365-v9-2","category-technical"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/33080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=33080"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/33080\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=33080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=33080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=33080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}