function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hmjolinghmjoling 

Use of same message when validation

Hello,

 

I've searched on the boards but haven't found an answer. We have the following case:

 

We have a lot of fields we need to validate. Some must be > 0, some may not exeed an certain amount, etc...

Instead of copying the same message over and over again by every field, I want to have only a few messages like:

"&1 must be > 0"

"&1 to large".

Where the &1 represents the field. For example:

 

"BookID must be >0"

"DVDID must be >0"

"BookTitle to large"

"DVDTitle to large"

 

When we can use a parameters (&1) to represent the fields, we don't have to go through every seperate field to change the message, but I only have to change the message itself.

 

Does anyone have any idea if an if so, how this is possible?

 

TIA,

Hilco Joling

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

If you're trying to create a dynamic error message in a VR that can't be done through the VR Setup.  You need to either create individual VR for each field with a specific message, or create generic VR for a group of fields.

All Answers

Steve :-/Steve :-/

If you're trying to create a dynamic error message in a VR that can't be done through the VR Setup.  You need to either create individual VR for each field with a specific message, or create generic VR for a group of fields.

This was selected as the best answer
Shivanath DevnarayananShivanath Devnarayanan
I agree with Stevemo,

Validation Rules are specific to each object and cannot be re-used across objects in a generic manner. But I'm sure its soon to come.

you can post an Idea so that salesforce can keep track of this useful enhancement.