Appointment Scheduling with Time Zones with i360 Classic
When an Appointment is added or updated, the Appointment Date, Appointment Time and Duration fields are set by the person scheduling the appointment. There is no time zone field - the time zone used is based on the time zone set on the User for the Owner of the Appointment. Time zones are set on the Salesforce Users record. The Owner of the Appointment can be changed as well as the time zone on the User's profile.
Scenario
- There is an Appointment being scheduled located in the America/Denver time zone.
- The Appointment Scheduler's time zone is America/New_York.
- The assigned Sales Rep's time zone is America/Los_Angeles.
- The Owner of the Appointment record is the Site Admin (auto-converted from an eLead) who time zone is set to America/Los_Angeles.
- What is the time of the Appointment located in the America/Denver time zone when the Appointment time is set for 9am by the Appointment Scheduler whose time zone is set to America/New_York?
Correct Answer
10am America/Denver time.
Why
Sine the Appointment Time is a Picklist field, the appointment time of 9am will always be 9am. However, Since the Sales Rep, Scheduler and the location of the appointment are all in different time zones, it is confusing on what the actual time of the appointment is. Since the Owner of the Appointment time zone is America/Los_Angeles and the Appointment Time is 9am, the appointment is at 9am America/Los_Angeles time or 10am America/Denver time because that is the time zone of location of the appointment.
The time values users sees and uses in the desktop and mobile application should be based on the time zone of the Owner's Salesforce User. The Appointment Time field will always be the same time since it is a Picklist field but the Computed Start DateTime field holds the actual Date, Time and Time Zone information necessary to know the actually start time of the appointment.
Technical Notes
The Appointment trigger looks at these fields and builds DateTime fields i360__Computed_Start_DateTime__c
and i360__Computed_End_DateTime__c
.
- The Appointment queried by date range are based on the
i360__Computed_Start_DateTime__c
field. -
i360__Computed_Start_DateTime__c
is calculated based on thei360__Start__c
andi360__Start_Time__c
fields. - The
i360__Computed_End_DateTime__c
is calculated based oni360__Computed_Start_DateTime__c
and thei360__Duration__c
field.
You can inspect the way values are stored in the database by running the query:
select i360__Start__c, i360__Start_Time__c, i360__Duration__c, i360__Computed_Start_DateTime__c, i360__Computed_End_DateTime__c
from i360__Appointment__c
where id = '<appointment-id>'
Which yields the results:
i360__Start__c | i360__Start_Time__c | i360__Duration__c | i360__Computed_Start_DateTime__c | i360__Computed_End_DateTime__c |
2020-07-14 | 9:00 AM | 2 Hours | 2020-07-14T16:00:00.000+0000 | 2020-07-14T18:00:00.000+0000 |
Notice there is no time zone offsets (+0000) stored in the DateTime fields but instead the time is adjusted to be based on the time zone of the Owner of the Appointment.
NOTE: This does not work similarly for Project Activities. Updating the Record Owner of the Project Activity will NOT adjust the Time Zone to the Assigned To Staff Member's Time Zone unless you turn on a Custom Setting.
Enable Record Owner Time Zone on Project Activity
You will enable a Custom Setting to allow Project Activities Time Zone to behave the same way as Appointment Time Zone and adopt the Time Zone of the Owner of the record.
Navigate to Setup > Custom Settings > Calendar Preferences and click Manage
Then click Edit
Be sure the Project Activity: Record Owner Time Zone is set to TRUE.
Next, check the customer's system to make sure they are updating the Project Activity record Owner to the Assigned To staff's User. (This may be done in Process Builder or Flows).