Understanding how to use a Vlocity Environment Variable can significantly improve the efficiency and flexibility of your OmniStudio configurations. These built-in variables—like $Vlocity.TODAY, $Vlocity.NOW, and $Vlocity.User—help you fetch real-time data such as dates, user details, and org-specific information without manual input.
Vlocity Environment Variable
In this guide, we’ll walk through the most common Vlocity Environment Variable options and show you exactly how to use them with practical formulas.
$Vlocity.TODAY
Description: Returns the current date.
Example Formula:
ADD_DAYS($Vlocity.TODAY, 7)
Adds 7 days to today’s date.
$Vlocity.NOW
Description: Returns the current date and time (timestamp).
Example Formula:
FORMAT_DATE($Vlocity.NOW, 'MM/dd/yyyy HH:mm:ss')
Formats the current timestamp.
$Vlocity.NULL
Description: Represents a null value.
Example Formula:
IF(ISNULL(FieldName), $Vlocity.NULL, FieldName)
Assigns a null value if a field is null.
$Vlocity.User
Description: Returns the current user’s ID.
Example Formula:
CONCAT('/apex/UserDetailPage?Id=', $Vlocity.User)
Builds a link to the current user’s detail page.
$Vlocity.Profile
Description: Returns the current user’s profile ID.
Example Formula:
IF($Vlocity.Profile == 'Admin', 'Administrator', 'Standard User')
Checks the user’s profile.
$Vlocity.Org
Description: Returns the organization ID of the current Salesforce org.
Example Formula:
CONCAT('Org ID: ', $Vlocity.Org)
Displays the org ID.
$Vlocity.Locale
Description: Returns the locale of the current user.
Example Formula:
IF($Vlocity.Locale == 'en_US', 'English (US)', 'Other Language')
$Vlocity.Session
Description: Returns session information for the current user.
Example Formula:
IF(ISNULL($Vlocity.Session), 'No Active Session', 'Active Session')
Conclusion
Mastering each Vlocity Environment Variable enables you to build more dynamic, context-aware logic within your OmniStudio tools. Whether you’re calculating future dates, checking user profiles, or validating sessions, these variables offer powerful shortcuts to streamline your configuration. Keep this guide handy as a quick reference whenever you need to work smarter with Vlocity!