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
Pankaj IRTPankaj IRT 

how could i show different error msg in different input in a single validation rule

Pankaj IRTPankaj IRT
I have one Object Student and which have a field phone no. I want that, if i insert a value more than 10 digit it give error msg mobile no not more than digit and if i insert less than 10 digit no then. It give a error msg that mobile no should be equal to 10 digit. In a single validation rule. SO how could i do this plz Help
Santosh Kumar Sriram_2310Santosh Kumar Sriram_2310
May I understand the specific reason as to why you want to try the same in a single validation rule and not two validation rules?
Pankaj IRTPankaj IRT
coz interviewer ask me today in interview
 
Santosh Kumar Sriram_2310Santosh Kumar Sriram_2310
Hey Pankaj,

Unfortunaltely that cannot be handled using standard validaton rule. You will have handle such dynamic rules in triggers.
Validation rule messages could be displayed in multiple languages using the translation workbench. 

Maybe it was a trick question!
For more on validation rules - https://help.salesforce.com/apex/HTViewHelpDoc?id=fields_about_field_validation.htm&language=en_US

Hope this helped! 

Thanks,
Santosh Kumar Sriram
William TranWilliam Tran
It is  a trick question and cannot be done by 1 validation rule.  That is 1 validation rule cannot have 2 different messages.

That said, if you use a trigger you can have 2 or even 20 different messages.

Thx
Pankaj IRTPankaj IRT
Thanks
 
Santosh Kumar Sriram_2310Santosh Kumar Sriram_2310
Thanks Pankaj,

Either select mine or William's answer as the best answer so that people can refer to this and conclude!
 
Pankaj IRTPankaj IRT
yes you both are right it can happen only with trigger
William TranWilliam Tran
Pankaj,  you can give every answer you like a thumbs up (by clicking the thumb up)

But you should and can only select 1 best answer.

As a common practice, if your question is answered, choose 1 best answer. 
But give every answer a thumb up if that answer is helpful to you.

Thanks,