+ Start a Discussion
Kishan Kumar 77Kishan Kumar 77 

I need to write a validation rule for a field so that it accepts numbers in a particular format.

1st requirement- if the number starts with B then it's length should be 6 only and it should be of format  e.g-B12345.

2nd requirement- the number should start from DE and it should be of length 7 only. For example-DE12345. There cannot be alphabets in between for example- DE123V4.

Both rules have to be applied on same field
AnudeepAnudeep (Salesforce Developers) 
I recommend reviewing this documentation for sample validations to get started. Also this article
mill panmill pan
The Cinderella Solution is a women-only weight loss system designed around a simple and practical flavor-paring method that removes the need for calorie. The Cinderella Solution is a 28-day weight loss program that is divided into 2 phases to help you fully understand and follow all the instructions in it. cinderella solution reviews https://cinderellasolution.guru
Suraj Tripathi 47Suraj Tripathi 47
Hi Kishan,

    IF(AND(BEGINS(CustomField__c, "B"),LEN(CustomField__c) == 6) ,false, true),
    IF(AND(BEGINS(CustomField__c, "DE"),LEN(CustomField__c) == 7) ,false, true)

If you find your Solution then mark this as the best answer. 

Thank you!

Suraj Tripathi