Create Time Zone Formula Field In Salesforce

Step 1: Access Object Customization

  1. Log in to your Salesforce account.
  2. Navigate to the “Setup” by clicking on the gear icon in the top-right corner.

3.Under “Object and Fields,” select “Object Manager.”

Step 2: Select the Object

  1. In the Object Manager, choose the object (e.g., Account, Contact, Opportunity) for which you want to create the time zone formula field here i am Selecting Account

Step 3: Create a New Formula Field

  1. Within the object’s detail page, scroll down to the “Fields & Relationships” section.

2.Click on the “New” button to create a new custom field.

3.Choose “Formula” as the field type and click “Next.”

Step 4: Define the Formula

  1. In the formula creation page, provide a unique field name and description.
  2. Under “Formula Return Type,” select “Text” as the data type for the time zone formula field.
  1. Use the appropriate formula functions to calculate the time zone based on the relevant criteria. For example, if you want to use the Account’s billing country to determine the time zone, you can use the “CASE” function with “ISPICKVAL” and “TEXT” functions to assign the respective time zone to each country.
  2. Test the formula by clicking on the “Check Syntax” button to ensure there are no errors.
  3. Click “Next” once the formula is correct.

Syntax:

  1. IF(CASE(BillingState, ‘CA’, 1, ‘NV’, 1,’OR’, 1, ‘WA’, 1, 0) >=1, “Pacific Standard Time”, null)+
  2. IF(CASE(BillingState, ‘AZ’, 1, ‘CO’, 1,’ID’, 1, ‘MT’, 1, ‘NM’, 1, ‘UT’, 1, ‘WY’, 1, 0) >= 1, “Mountain Standard Time”, null)+
  3. IF(CASE(BillingState, ‘AL’, 1, ‘AR’, 1, ‘IL’, 1, ‘IA’, 1,’KS’, 1, ‘LA’, 1,’MN’, 1,’MS’, 1,’MO’, 1,’NE’, 1,’ND’, 1, ‘OK’, 1,’SD’, 1,’WI’, 1, 0) >= 1, “Central Standard Time”, null)+
  4. IF(CASE(BillingState, ‘CT’, 1, ‘DE’, 1, ‘GA’, 1, ‘ME’, 1, ‘MD’, 1, ‘MA’, 1,’MI’, 1, ‘NH’, 1, ‘NJ’, 1, ‘NY’, 1, ‘NC’, 1, ‘OH’, 1, ‘PA’, 1, ‘RI’, 1, ‘SC’, 1, ‘VT’, 1, ‘VA’, 1, ‘WV’, 1, 0) >= 1,”Eastern Standard Time”, null)+
  5. IF(CASE(BillingState, ‘AK’, 1, 0) >=1, “Alaskan Standard Time”, null)+
  6. IF(CASE(BillingState, ‘HI’, 1, 0) >=1, “Hawaiian Standard Time”, null)+
  7. IF(BillingState = ‘FL’, IF(MID(Phone,2,3) = “850”,”Central Standard Time”,”Eastern Standard Time”),null)+
  8. IF(BillingState = ‘IN’, IF(MID(Phone,2,3) = “219”,”Central Standard Time”,”Eastern Standard Time”),null)+
  9. IF(BillingState = ‘KY’, IF(MID(Phone,2,3) = “270”,”Central Standard Time”,”Eastern Standard Time”),null)+
  10. IF(BillingState = ‘TX’, IF(MID(Phone,2,3) = “915”,”Mountain Standard Time”,”Central Standard Time”),null)+
  11. IF(BillingState = ‘TN’, IF(CASE(MID(Phone,2,3),”865″,1,”423″,1,0)>=1,”Eastern Standard Time”, “Central Standard Time”),null)

Step 5: Define Field-Level Security and Page Layouts

  1. In the next section, define the field-level security for the time zone formula field for different profiles. Choose who can view and edit the field based on your organization’s requirements.
  2. Select the appropriate page layouts where you want to display the time zone formula field.
  3. Click “Next” when you have made your selections.

Step 6: Review and Save

  1. Review the summary of your new time zone formula field settings.
  2. If everything looks correct, click “Save” to create the time zone formula field.

Step 7: Test and Validate

  1. After creating the time zone formula field, navigate to records in the selected object to verify that the formula is calculating the correct time zone based on your criteria.
  2. Make any necessary adjustments to the formula if needed and retest until it produces the desired results.
  3. By following these steps, you can create a time zone formula field in Salesforce to automatically calculate and display the time zone based on specific criteria. This can be useful for ensuring that users view and manage data in the appropriate time zone, enhancing the efficiency of your Salesforce data management.