Creating a Validation Rule for France GLA Name Format

The options below enable you to create a validation rule on the General Ledger Account object. This rule requires the name of a GLA with a France localization to start with four digits. The rule applies when a GLA is created or an existing one is edited. For general information about creating validation rules, see the Salesforce Help.

Error Condition Formula

In the Error Condition Formula field, enter the following:

Copy
AND(
  TEXT(c2g__Localization__c) == "FR",
  NOT(
    AND(
      LEN(Name) >= 4,
      AND(
        CONTAINS("123456789", MID(Name, 1, 1)),
        AND(
          CONTAINS("0123456789", MID(Name, 2, 1)),
          AND(
            CONTAINS("0123456789", MID(Name, 3, 1)),
            CONTAINS("0123456789", MID(Name, 4, 1))
          )
        )
      )
    )
  )
)

Error Message

Complete the following steps:

  1. In the Error Message field, enter the message to display when the validation rule is not followed, for example: The first four characters of the GLA name must be numbers when the localization is "FR".
  2. In the Error Location field, select Field.
  3. Select "Name" in the drop-down list.

The error message will display under the Name field when the name does not start with four digits.