VIES validation for customer records.
Overview
When you create or edit a customer in NetSuite, the VAT number can now be validated automatically.
The script checks the number against:
– VIES (EU’s official VAT database)
– CVR (for Danish companies only)
This ensures VAT numbers are valid and belong to the correct company.
For Danish entities, you can also fetch the VAT number directly using a lookup button.
What this means for you:
- You no longer need to manually check if a VAT number is valid.
- The system will warn you if the number is missing, invalid, or doesn’t match the company name.
- For Danish companies, you can click the 🔍 icon to fetch the VAT number automatically.
- The record cannot be saved with an invalid VAT number unless you explicitly confirm.
Key features:
- Automatic VAT validation when you enter or edit a VAT number
- Error messages shown directly in the form (no disruptive pop-ups)
- Automatic saving of validation status and last checked date
- Company name cross-check with VIES
- Special CVR lookup button for Danish companies
Fields you can see:
How it behaves:
On form load
- Hides NetSuite’s built-in (and broken) VIES link field
- If the customer is Danish, a 🔍 lookup button appears next to the VAT field
- If a VAT number is already filled in but not validated, it will be checked automatically
When you change VAT
- The system first normalizes the VAT (adds the country prefix if missing, trims invalid characters)
- If the format looks wrong → ❌ error message appears
- If the format is correct → the system calls VIES:
- ❌ Invalid → red error toast, VAT marked as invalid
- ⚠️ Name mismatch → yellow warning with choice: confirm anyway or clear the field
- ✅ Valid & matching → green success toast, VAT marked as validated
When you save the record
- If the VAT number is invalid or unvalidated, a confirmation prompt appears
- If you decline, the record will not save until the VAT issue is resolved
- If you accept, the VAT will be cleared, and the record will be saved without it
Example of workflow:
- Open a customer record
- Enter VAT number
5566778899for a Danish company- The system automatically changes it to
DK5566778899
- The system automatically changes it to
- If the number is valid, you’ll see a ✅ green toast: Valid VAT number!
- If VIES says it belongs to a company whose legal name doesn’t match the company name in NetSuite, you’ll be asked whether to confirm anyway or clear the field
- On save, the record will only proceed if the VAT number has been validated, if not you’ll get a dialog box that tells you that the field will be cleared if you chose to proceed saving the record
Result: You can be sure VAT numbers are correct before using them on invoices and reports.