I am having an issue with a validation on a field in my Case object.I have the below requirement.Can somebody help?

The Field should allow only a total 11 digits. These 11 digits can be divided into 3 parts:

  1. The first 3 digits are the Prefix which are always unique
  2. The next 7 digits is the Serial Number
  3. The last digit is the Check digit

For example if the user enters the value in the filed as 589 8114074 3:

Disregard the first 3 unique Prefix numbers and the last Check Digit [because that’s what we are going to find and match it with the actual check digit]

Just consider the 7 digit Serial Number, 8114074 and divide this by 7 [the number 7 is a constant, Mod7]

The remainder determines the Check Digit

Example, Serial Number 8114074 when divided manually by 7 the remainder is 3.

This remainder matches with the check digit of the field, hence the value 589 8114074 3 in the field should validate as correct.

  • What have you tried so far to achieve this requirement? What specific issue did you encounter when you made an attempt?
    – David Reed
    Commented Mar 7, 2019 at 13:19
  • I am a beginner and i am trying to create a formula field for this but cannot wrap my head around it. Commented Mar 7, 2019 at 13:20

1 Answer 1


Considering that your number is without spaces (ie: 58981140743 ), the solution could be limiting maximum number of characters in the field using its settings and limiting minimum field characters through a validation rule such as:

OR(NOT(MOD(VALUE(RIGHT(LEFT(number__c,10),7)),7) = VALUE(RIGHT(number__c, 1))), LEN(number__c) <> 11)
  • Thanks @Dahn What about validating the logic for MOD7 compliant for numbers starting from 4th position to 10th position? Can we use REGEX to do it? Commented Mar 7, 2019 at 15:16
  • @PseudoDarwinist we could use regex to check if pattern matches, but not for locate or manage text. You could use SUBSTITUTE(number__c, " ", "") wherever number__c appears to remove spaces.
    – Dahn
    Commented Mar 7, 2019 at 15:19
  • Thanks @Dahn.That's the requirement.When customer enters the the 11 digit number,i want to verify that the numbers from 4th position to 10th is mod7 compliant.Meaning if i divide the 7 numbers(from 4th to 10th) by 7,the remainder matches the last digit(12th position) Commented Mar 7, 2019 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .