top of page
OmniStudioFactBg.png
  • Writer's pictureSuresh A

Different ways to display validation messages in an Omniscript

As per the salesforce order of execution, custom validations fire after the system validations.

Let's see different ways to set up validation messages in an Omniscript with some examples:


1. Marking an input element as Required will display the validation message in the current step.


2. Messaging elements can be used to display success, warnings, comments, or requirements based on the validation expression.


To display the message, select the type of message to be displayed when the validation expression returns true or false and add the message to be displayed.


Let’s see a few example scenarios:


  • Consider we have a picklist element named Stage. If its value is Closed Won it should display a Success Message on the step.

  • For this use case, add a messaging element in the Step, and in the properties add the message you want to display and make it Active.

  • Similarly, if the Stage is Closed Lost and if we want to display a warning message then configure it as below:


3. Set Error element, on the other hand, will display a validation message on the element in the previous step based on the condition from the future step.

This helps ensure that the data is complete by sending the end user back to an incomplete step and helping them fix that problem.


Let’s see an example of using the Set Error element to display a message when the First Name is empty:

  • Add the Set error after the step where the First Name element is added.

  • In the Set Error element properties click on +Add New Element value and select the Element Name for which we need to display the error and also add the value to validate it.

  • If you want to use an expression to validate the value then you need to select the “Use Expression For Value” checkbox and add your expression and error message as well.

  • Whenever the FirstName field is empty it will display the Custom Error that you have added.

Note: You can display Standard Error as well by making the field Required.


4. Default Error Message

It can be set if we want to replace the default message set by Salesforce with a user-friendly message. It will be returned when no custom messages are defined or matched.

We can set it only for File, Image, and Action elements.



5. Custom Error Messages

These messages are returned based on the path and the value defined while setting it up. We can set it only for File, Image, Action elements, and from Setup.


  1. Path: Add the path to the original error message.

  2. Value: Add the original error message.

  3. Message: Add the custom error message that will replace the original error message


6. Validation using Pattern:

We can validate the input against a pattern by adding a regular expression.

For example: To validate if a number is 10 digits, use the Pattern Validation



7. Using Text Block element:

We can display the messages using text blocks if we want to add a different style to the message using the Rich Text editor.


Here is an example in which we are displaying the error message when the Last Name is empty.


9,415 views2 comments

Recent Posts

See All

Email Action in Omniscript

Email Action The Lightning Email Action allows emails to be sent from anywhere in Salesforce. It will enable greater customization, such...

OmniStudioFactFooterBg.png
logo.png

OmniStudiofacts helps us to build a Vlocity/OmniStudio Tech Community which focuses on sharing technical skills and experience across the globe.

© 2023 by OmniStudioFacts.

bottom of page