Vault queries
JavaScript query reference
Use Vault helpers to check collected records and, when necessary, retrieve matching data from another NIM system table.
Vault query functions are available in custom JavaScript columns. They work with data NIM has already collected into the Vault; they do not query a connected source system live.
Choose the right functionDirect link to Choose the right function
| Function | Use it when | Returns |
|---|---|---|
vaultObjectExists | You know the table’s primary-key value and only need to know whether the record exists. | true or false |
vaultObjectExistsByRef | You need to check a value in a configured reference column. | true or false |
vaultObjectFind | You need values from a matching record rather than a simple existence check. | An array of matching records, or an empty array |
vaultObjectFind.Check a primary key with vaultObjectExistsDirect link to check-a-primary-key-with-vaultobjectexists
Use this function when the lookup value is the table’s configured primary key.
return vaultObjectExists('hr500', 'employees', '10023963');
| Argument | Required | Description |
|---|---|---|
| System name | Yes | The NIM system that contains the collected table. |
| Table name | Yes | The table to check. |
| Lookup value | Yes | The primary-key value to find. |
The example returns true when hr500 contains an employees record whose primary key is 10023963; otherwise, it returns false.
Check a reference key with vaultObjectExistsByRefDirect link to check-a-reference-key-with-vaultobjectexistsbyref
Use this function when the value is stored in a column configured as a reference key.
return vaultObjectExistsByRef('hr500', 'employees', 'ssn', '999-888-7777');
| Argument | Required | Description |
|---|---|---|
| System name | Yes | The NIM system that contains the collected table. |
| Table name | Yes | The table to check. |
| Reference column | Yes | A column marked as a Reference in the table properties. |
| Lookup value | Yes | The value to find in that reference column. |
This returns a Boolean. It does not return the matching employee record.
Retrieve matching records with vaultObjectFindDirect link to retrieve-matching-records-with-vaultobjectfind
Use vaultObjectFind only when the script genuinely needs a value from the matching record. It returns an array, so handle the no-match case before accessing an item.
const records = vaultObjectFind('hr500', 'employees', 'ssn', '999-888-7777');
return records.length > 0 ? records[0]['FirstName'] : '';
| Argument | Required | Description |
|---|---|---|
| System name | Yes | The NIM system that contains the collected table. |
| Table name | Yes | The table to search. |
| Reference column | Yes | The column to search. |
| Lookup value | Yes | The value to match. |
| Case-sensitive flag | No | Whether the comparison must respect letter case. |
vaultObjectFind can be computationally expensive. Avoid using it in calculations that run across a large number of records unless there is no simpler model or relation that meets the need. Test with representative data before placing it in a production workflow.
Before using a Vault queryDirect link to Before using a Vault query
- Confirm the target system has been collected and its data is current.
- Verify the exact system name, table name, and column name in NIM.
- For
vaultObjectExistsByRefandvaultObjectFind, make sure the lookup column is configured as a reference column. - Return a safe fallback value when no record is found.
- Consider an intra-system relation, inter-system relation, or filter lookup when the requirement is a repeatable data relationship rather than a one-off calculation.
For calculation patterns and guidance on safe handling of blank values, return to Custom JavaScript columns.