Skip to main content

Validate Worker Attribute Values

Add a format rule to a worker attribute so people can only save values in the right format, and see how values from imports, integrations, and the API are handled.

A validation rule checks the format of a worker attribute's value, such as an email address, a phone number, or a postal code. You set the rule once, on the attribute, and Fountain checks it every time a value is written to that attribute.

This article covers worker attributes. To check the format of an answer to a Hire application question, see Data Entry Validation and Standard Questions With Data Validation.

What a Rule Does, and What It Doesn't

  • When someone types a value in a worker profile or answers an Onboard form, they can't save it until it matches the rule.

  • Values written by imports, integrations, automations, and the API are never refused. They're saved and flagged on the worker profile.

  • Adding a rule doesn't recheck values already saved. A value is checked the next time it's written.

  • A rule doesn't make an attribute mandatory. An empty value is always accepted.


Add a Validation Rule

You need the permission to edit worker attributes in Settings.

  1. Click your company logo in the left side panel and then Settings.

  2. Click the Worker Attributes settings link.

  3. Click … (More actions) at the end of the attribute's row, then Edit. To give a new attribute a rule, click Add attribute instead.

  4. Under Validation, click Add validation.

  5. Choose a Format. The list depends on the attribute's type. An example of an accepted value appears under the list.

  6. Fill in the setting the validator asks for, if any. See the table below.

  7. Type a sample in Test a value, then click Test value or press Enter. Fountain answers This value passes. or shows the message people will see. Test the formats people really use, not only the example.

  8. Click Save.

The rule now shows in the Validation column of the worker attributes table, for example Postal code: US.

An attribute has one rule, and a rule takes one country. To accept several formats, use Pattern (regular expression).

Validators and What They Accept

Validator

Setting

What passes

Text attributes

Email address

None

Phone number

Country or locale, optional

Empty: only international format with no spaces, such as +14155550100. With en-US: (415) 555-0100, 415-555-0100, 4155550100, or +1 415 555 0100. Some countries accept mobile numbers only.

Bank account number

None

Digits only, any length

US bank routing number (ABA)

None

A valid 9-digit routing number, such as 021000021

IBAN

None

An IBAN, such as GB82WEST12345698765432

National or tax ID

Country or locale, required, such as en-US

With en-US: an EIN, such as 12-3456789. A Social Security number (123-45-6789) doesn't pass.

Passport number

Country or locale, required, such as US

That country's passport format only. With US: 9 digits, or a letter and 8 digits.

Postal code

Country or locale, optional, such as US

Empty: most postal code formats. With US: 94107 or 94107-1234.

Restricted characters

The characters to refuse, with no separators, such as #$%

Any value without those characters

Minimum length, Maximum length

Limit: a whole number, 0 or more

A value with at least, or at most, that many characters

Pattern (regular expression)

Pattern: up to 500 characters, such as ^[A-Z]{2}[0-9]{6}$

A value that matches the pattern

Number attributes

Minimum value, Maximum value

Limit: any number

A number at or above, or at or below, the limit

Date attributes

Past dates only

None

Today or an earlier date

Future dates only

None

A date after today

Boolean, Select, Address, Media, Signature, and Compliance Document attributes can't have a rule.

Things to know before you choose:

  • Two kinds of codes. Phone number and National or tax ID take a locale, such as en-US. Postal code and Passport number take a two-letter country code, such as US.

  • Leaving the phone locale empty is the strictest setting. If your workers are in one country, set its locale.

  • There's no Social Security number validator. For SSNs, use a pattern such as ^\d{3}-\d{2}-\d{4}$.

  • A passport rule accepts one country's passports. Don't use it if your workers may hold passports from other countries.

  • Spaces count. A space before or after a value makes it fail.

  • Patterns use JavaScript syntax and are case-sensitive. A pattern matches anywhere in the value unless you anchor it with ^ at the start and $ at the end.

  • Dates are compared with today in UTC, so near midnight the day can differ from your local date.

Add a Rule From the Onboard Flow Builder

In a data collection task, choose the worker attribute that stores the answer, then click Edit validation under it. This edits the same rule as Settings. A change made here applies everywhere the attribute is used, and clears the attribute's flags (see Change or Remove a Rule).


Where a Rule Applies

Where the value comes from

What happens to a value that breaks the rule

An admin editing a worker profile

Refused. The message appears under the field.

A worker answering an Onboard data collection task

Refused. The worker can't continue until they correct it.

An admin reviewing answers in an Onboard Review data task

Saved and flagged

CSV worker import, Data Pipelines

Saved and flagged

The API, integrations, and automations

Saved and flagged

A hired applicant becoming a worker, a rehire

Saved and flagged

Workers can't edit their own attributes outside Onboard. I-9 and W-4 tasks don't write attributes a rule can apply to.


What People See When a Value Is Refused

In a worker profile, only the field that breaks the rule is refused. Each attribute is saved on its own, so the other fields aren't affected. The message under the field ends with the format the attribute expects, for example "Enter a 5-digit ZIP code, like 94107. This attribute validates as Postal code." Correct the value and click Save again.

In an Onboard form, the worker sees the message under the question. Once they correct the answer, they can continue.

The message depends on the validator:

Validator

Message

Email address

Enter an email address, like [email protected].

Phone number, no locale

Enter a phone number in international format, like +14155550100.

Phone number, with a locale

Enter a valid phone number for en-GB.

Bank account number

Enter a valid bank account number.

US bank routing number (ABA)

Enter a 9-digit US routing number, like 021000021.

IBAN

Enter an IBAN, like GB82WEST12345698765432.

National or tax ID, en-US

Enter an EIN, like 12-3456789.

National or tax ID, other locales

Enter a valid tax ID for fr-FR.

Passport number

Enter a valid passport number for US.

Postal code, US

Enter a 5-digit ZIP code, like 94107.

Postal code, other countries

Enter a valid postal code for GB.

Postal code, no country

Enter a valid postal code.

Restricted characters

Remove these characters: #$%.

Minimum length

Enter at least 5 characters.

Maximum length

Enter at most 20 characters.

Minimum value

Enter a number of at least 18.

Maximum value

Enter a number no greater than 65.

Past dates only

Enter a date in the past.

Future dates only

Enter a date in the future.

Pattern (regular expression)

This value doesn't match the required format.

Messages are always in English, including in a translated Onboard flow.

Tell People the Format Up Front

A pattern rule only says "This value doesn't match the required format." Put the expected format where people type the value: in the attribute label, or in the Onboard question, for example "Badge number (like GF-12345)".

No Exception for One Worker

No one can override a rule for a single worker. If a rule refuses a value that is correct, the rule is too strict: change it.


Find and Fix Flagged Values

When an import, an integration, an automation, or the API writes a value that breaks the rule, Fountain saves it and shows this on the worker profile:

Value is invalid; Worker may not appear in segments that rely on this attribute. Please update or resubmit to confirm value.

A flag set by a rule doesn't change the value. Segments, automations, and exports keep reading the value as it is.

To clear a flag, save a value that passes the rule, either in the worker profile or from the system that sent it. Sending the same value again flags it again.

A value is checked every time it's written, even if it hasn't changed. An integration that sends every worker's data each night flags its bad values on its next run, including values saved before the rule existed. Automations only write values that change.

There's no list of flagged workers yet. Flags show on each worker profile. If you send data with the Workers API (POST or PATCH /workers), the response gives each flagged value validationStatus: "invalid" and the rule's message in invalidDetail.

Fix the Format at the Source

If an integration keeps sending a format the rule refuses, a fix made in Fountain lasts only until its next run. Fix the format in the sending system. If Fountain set up that integration for you, contact your Customer Success Manager.


Change or Remove a Rule

Changing or Removing a Rule Clears Its Flags

Every flag set by the rule disappears as soon as you save, including on values that would still fail the new rule. Fountain doesn't keep a history of rule changes. Note the current rule before you change it.

To change a rule, edit the attribute and pick another validator or setting. Values already saved aren't rechecked: each one is checked against the new rule the next time it's written.

To remove a rule, edit the attribute, click Remove next to Validation, then Save. The values themselves don't change.


If a Rule Can't Be Saved or Tested

Message

What to do

Finish setting up this validator before testing or saving it.

A required setting is empty: the limit, the pattern, the characters, or the country. Fill it in.

This validator needs a locale, such as en-US.

National or tax ID needs a locale. Enter one.

This validator needs a two-letter country code, such as US.

Passport number needs a country code. Enter one.

Enter a whole number, 0 or more.

A length limit can't be negative or a decimal.

Enter a pattern with 500 characters or fewer.

Shorten the pattern.

This validation rule can't be saved. Check its settings, such as the pattern, the country code or the limits, and try again.

A setting isn't supported. A common cause: a postal code country entered as a locale (en-US) instead of a country code (US).

This pattern can't be used because it could take too long to check. Simplify it, for example by avoiding a repeat inside a repeat, like (a+)+.

Fountain refuses patterns that could take too long to check. Simplify the pattern.

This isn't a valid regular expression. Check the pattern and try again.

The pattern has a syntax error. Fix it.

This rule can't be used as set up. Check its settings and try again.

This validator doesn't support that country or locale. Try another code.

We couldn't test this value. Try again.

A temporary problem. Try again.

Did this answer your question?