The Local Time App for Salesforce has out-of-the-box support for getting the time zone information for Account, Contact, Lead, and Task standard Salesforce objects. We have now extended the App’s functionality to also support the Salesforce Event object.
When a user creates an Event in Salesforce, the Event Start and Event End Dates are displayed in the Salesforce user’s time zone. However, the related record (Lead, Contact, Account, Opportunity) of the Event could be in a different time zone. Thus, it will be useful to also have the Event Start and End dates in the related record’s time zone so that you can use this information, for instance, in your outbound communication (Example: meeting appointment email).
If you have a similar requirement, please read the rest of this article to understand how you can fulfil the requirement.
Pre-requisite
It is assumed that you have installed Local Time App version v2.25 or later in your sandbox and production environments. You can install the latest version of the App from this link.
Process
- Create the Activity object custom fields.
- Configure the App for the Event object.
- Enable the triggers on the Event object.
1. Create the Activity object custom fields
From Setup -> Object Manager, select the Activity object and create the following fields.
Label | API Name | Data Type | Comments |
---|---|---|---|
Event Start Date | Event_Start_Date__c | Text(20) | Event start date in the related record time zone. |
Event End Date | Event_End_Date__c | Text(20) | Event end date in the related record time zone. |
Timezone * | tz__Timezone__c | Text(10) | Event Start Date timezone abbreviation (PST, EST, etc.) for the related record (Lead, Contact etc.). |
Event End Timezone | Event_End_Timezone__c | Text(10) | Event End Date timezone abbreviation (PST, EST, etc.) for the related record (Lead, Contact etc.) |
UTC Offset * | tz__UTC_Offset__c | Number(3, 2) | Event Start Date UTC timezone offset for the related record (Lead, Contact etc.). |
Event End UTC Offset | Event_End_UTC_Offset__c | Number(3, 2) | Event End Date UTC timezone offset for the related record (Lead, Contact etc.) |
Timezone IANA | Timezone_IANA__c | Text(35) | Timezone as defined by IANA. Example: America/New_York |
* In the example, we are re-using two fields that are already included in the App. However, if you prefer, you can also create your own custom fields (for example: Event Start Timezone and Event Start UTC Offset).
2. Configure the App for the Event object
From Local Time Config tab -> Settings subtab, configure the Event object to use the fields created in Step 1.
3. Enable the triggers on the Event object
From Local Time Config tab -> Settings subtab, enable the triggers on the Event object and click the Save button to update the App settings.
Example 1
Assume that your time zone in Salesforce is US Eastern (America/New_York). The related record on the Event is a lead and it is in US Pacific (America/Los_Angeles) time zone.
You created an event at 1 PM EST on December 01, 2022 lasting for an hour. After the event is saved, you can see that the Event Start Date, Event End Date, and other custom fields created in Step 1 show the event details in the related record’s time zone.
Example 2
Assume that your time zone in Salesforce is US Eastern (America/New_York). The related record on the Event is a lead and it is in US Pacific (America/Los_Angeles) time zone.
You created a two-day event starting at 1 PM EST on March 11, 2022. After the event is saved, you can see that the Event Start Date, Event End Date, and other custom fields show the event details in the related record’s time zone.
Note that the Event End Date is in PDT (Pacific Daylight Time) because in the US the clocks will be forwarded by an hour on March 12, 2023 to adjust for DST (Daylight Saving Time).