function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC_2706SFDC_2706 

Auto Update time zone based on country

Hi Everyone

I am struggling with this requirement where when user inserts country value in Lead then field called "Time zone" should auto populate with the respective time zone of that country.
I tried many things but no success. If anyone has done this in his/her CRM, please do post your favorable answer.
Thanks in advance.
Glyn Anderson 3Glyn Anderson 3
Ronu,

First, I must ask if you are using Country and State Picklists, or if your country fields are free text?  This will change the nature of the solution a bit.  Also, how do you want to handle countries that have more than one timezone (like the US, Russia and Australia)?  Do you have to dirll down by state, city and/or postal code?

If your company/client is willing to pay for Google services, Google Maps has a Time Zone API (https://developers.google.com/maps/documentation/timezone/intro).  You wouldn't be able to make a Web API callout in a trigger, but you could call an @future method to do it.

If you can't use an API, then please answer my questions above, and I'll try to help you devise a solution.
SFDC_2706SFDC_2706
Hi Glyn

Thanks for reverting and giving your time on this. I am not sure if my company would be willing to pay for Google services..!!
However i can give you information on the fields type. Country and state are picklist fields enabled from standard salesforce feature and yes you are right many countries have more than 1 time zones and for this i would like to drill down by city field. Rather than using country i would like time zone to be set using city text field in the contact address.

I hope this makes sense to you as well and looking forward to your swift and favorable response. Thanks in advance..!!