Veeva Vault Criteria VQL Guide: Reference Constraints, {{this.field}} Tokens & Sharing Rules
Inside the Veeva Vault Admin UI, you often need to filter selectable records or restrict access without writing a full API query. That is where Criteria VQL comes in.
Unlike full VQL queries executed over the REST API, Criteria VQL omits SELECT, FROM, and WHERE—you write only the filter expression itself.
Interactive Companion Tool: Build and validate Criteria VQL expressions with
{{this.field_name}}tokens in your browser using our Veeva Vault Criteria VQL Generator.
1. Where Criteria VQL Is Used in Vault Admin
- Reference Constraints: Restrict which parent or related records users can pick in a lookup field (e.g., showing only active countries for the current study).
- Custom Sharing Rules: Grant or restrict record access based on field values (e.g.,
country__vr.name__v IN ('United States', 'Germany')). - Query Object Rules: Filter related object or document sections on page layouts.
2. Dynamic Reference Constraints with {{this.field_name}}
Static constraints filter by fixed values (status__v = 'active__v'). Dynamic Reference Constraints use {{this.field_name}} to bind a field value from the current record being edited:
study__v = {{this.study__c}}
AND status__v = 'active__v'
In this example, when a user selects a site or country record, Vault dynamically filters options to those matching the current record's study__c field.
3. Common Criteria VQL Mistakes to Avoid
- Including
SELECTorWHERE: Criteria VQL is only the conditional expression; omitSELECT ... FROM ... WHERE. - Using UI Labels Instead of API Names: Always use lowercase Vault API names (
status__v,phase__v,country__vr.name__v). - Missing Quotes on String Values: Wrap string literals in single quotes (
'active__v'), and wrapINlists in parentheses (('United States', 'Germany')).
Related Tools & Guides
- Tool: Veeva Vault Criteria VQL Generator
- Tool: Veeva VQL Formatter & Linter
- Tool: Veeva API Name Generator
- Guide: Getting Started with the Veeva Vault REST API and VQL
- Hub: All Veeva Tools
