Access Cards Must Have Set Number of Digits
  • 28 Sep 2022
  • 1 Minute to read
  • Comment

Access Cards Must Have Set Number of Digits

  • Comment

This validation lets you control the number of digits required for all access cards you add to customers via the Admin Panel.

This rule is particularly useful if your access cards have a set number of digits and you want to avoid any mistakes or typos when admins add cards to a customer's account.


  1. If the navigation menu isn't visible, click the menu icon in the top left corner of the page.

  2. Click Add rule

  3. Click on Manual entry

  4. Name your validation rule.

  5. Add a Description for your rule to let other admins know what it does at a glance.

  6. Enable the This rule is active toggle.

  7. Select Customer as the rule's Record type.

  8. Add the Error message to display if the validation rule is not met.

  9. Add the following code snippet to the Formula field.

record.AccessCardId = null OR record.AccessCardId.Length = x
  1. Replace the x after record.AccessCardId.Length = with the number of digits you require for access cards.

In the example below, we added 10, meaning all access cards that we try to register for customers must be 10 digits.

record.AccessCardId = null OR record.AccessCardId.Length = 10
  1. Click the Save Changes button.


All done! We recommend trying to assign an access card to a customer using the wrong number of digits to test your rule. If you receive the error message you've defined in the rule as you try to save your changes, you're good to go!


Was this article helpful?