Skip to content
Omniscript

How to use date time input in omniscript salesforce?

September 24, 2025

In this tutorial, we’ll walk through a powerful OmniScript use case where we manage Date and Date/Time inputs in omniscript salesforce, convert them across multiple time zones, and dynamically set default dates, min dates, and max dates.

We’ll also see how to properly display the selected dates from the running User’s Local time zone to Australia, Paris, and the User’s Current time zone.

Use Case: Scheduling a Service Appointment

Imagine a customer booking a broadband installation through your self-service portal built with OmniScript. The customer needs to pick:

  • Preferred Installation Date (If only Date is required)
  • Preferred Installation Date Time Slot (Date/Time input)

In this scenario, we will:

  1. Let the user select the date and time.
  2. Convert the time to Australia/Sydney, Europe/Paris, and the User’s Current time zone.
  3. Display the converted date and time in real-time.

Also Read: Import & Export Omniscripts in New Designer

Step 1: Set Up Date and Date/Time Inputs

In Step 1 of the OmniScript, we start with two critical fields: the Date field and the Date/Time field.

Date Field Configuration

  1. Default Date: Set the default date to Today so that it pre-fills the current date for the user.
  2. Start Date: Restrict the user from selecting any past date by setting the min date to Today.
  3. End Date: Allow the user to select a future date up to 1 year ahead by setting the max date to Today + 1 year.

Example:

  • Default = Today
  • Min Date = Today
  • Max Date = Today + 1 year
Date Field Configuration

Date/Time Field Configuration

For the Date/Time field, we allow the user to pick both the date and the time. The local time zone will be used to adjust the time based on the user’s browser or Salesforce settings.

Date/Time Field Configuration

Step 2: Handling Time Zone Conversion with DataRaptor

Once the user selects the date and time, we capture this value in a Set Values element and store it in the variable setDateTime. By default, this value is saved in UTC.

We then use DataRaptor to transform this UTC time into three different time zones:

  1. Australia/Sydney
  2. Europe/Paris
  3. User’s Current Time Zone

DataRaptor Formula for Time Zone Conversion

To convert the stored UTC time into these time zones, we use the following formulas:Australia/Sydney:

DataRaptor Formula for Time Zone Conversion
%FORMATDATETIME(%setDateTime%,"yyyy-MM-dd'T'HH:mm:ss.SSSZ","Australia/Sydney")%

Europe/Paris:

Europe/Paris:
%FORMATDATETIME(%setDateTime%,"yyyy-MM-dd'T'HH:mm:ss.SSSZ","Europe/Paris")%

User’s Time Zone (dynamic):

User's Time Zone (dynamic):
%FORMATDATETIME(%setDateTime%,"yyyy-MM-dd'T'HH:mm:ss.SSSZ",%userTimeZone%)%

These formulas will convert the stored UTC time (setDateTime) into each of the respective time zones, ensuring that the time shown to the user is accurate.

These formulas will convert the stored UTC time (setDateTime) into each of the respective time zones, ensuring that the time shown to the user is accurate.

Step 3: Displaying Converted Time Zones

In Step 2 of OmniScript, we display the converted date and time in three fields:

  1. Australia/Sydney Time Zone
  2. Europe/Paris Time Zone
  3. User’s Current Time Zone
Displaying Converted Time Zones

These fields will dynamically update and show the correct date and time based on the user’s selection, and will adjust automatically to their local time zone, the Australian time zone, and the Paris time zone.

Key Points Covered in This Example:

  1. Date and Date/Time Inputs:
    • Setting the default date to Today.
    • Configuring min date and max date to ensure valid date selections.
    • Date/Time fields with local timezone handling.
  2. Time Zone Conversion:
    • Using DataRaptor to convert UTC time into Australia, Paris, and User Time Zones.
    • Dynamically pulling the user’s time zone with %userTimeZone% and passing it into the formula.
  3. Display Converted Values:

Display the converted Australia/Sydney, Europe/Paris, and User Time Zone values in text fields.

Conclusion

This simple yet powerful solution in OmniScript allows you to capture, convert, and display time values across different time zones—from a local time picker to globalized date and time handling. By leveraging DataRaptor formulas and Set Values, you can ensure users get the correct date and time representation, no matter where they are in the world.where they are in the world.

Keep Reading

Related Articles and Resources

Lightning Web Components (LWC) Tutorial: A Beginner-to-Advanced Guide
September 18, 2025

Lightning Web Components (LWC) Tutorial: A Beginner-to-Advanced Guide

This LWC tutorial is designed to walk you through what...

A Beginner’s Guide to OmniStudio: Streamlining Your Salesforce Experience (FlexCards)
October 27, 2024

A Beginner’s Guide to OmniStudio: Streamlining Your Salesforce Experience (FlexCards)

What is Omnistudio OmniStudio is a powerful set of...

Using Datatable in Omniscript and pass data from OS to flexcard
November 9, 2024

Using Datatable in Omniscript and pass data from OS to flexcard

This blog will cover how data pass from Omniscript to...

Embedding Standard Designer FlexCards in Lightning Web Components (LWC)
October 14, 2025

Embedding Standard Designer FlexCards in Lightning Web Components (LWC)

The namespace-flex-card-standard-runtime-wrapper component...

Quick Start: Build Your First Agent with Agentforce Salesforce
October 30, 2024

Quick Start: Build Your First Agent with Agentforce Salesforce

Salesforce’s Agentforce is a powerful tool that allows...

Pass data from Flexcard to Datatable
November 9, 2024

Pass data from Flexcard to Datatable

There are several ways to pass data from a FlexCard to a...