Query the Vault from filter JavaScript
Filter JavaScript reference
Query NIM's Vault from a filter-specific JavaScript column when the calculation needs to check another collected record.
Use these helpers in a JavaScript filter column. Before querying, make sure the target system has been collected and its table has the appropriate primary or reference key.
Choose and use a Vault helperDirect link to Choose and use a Vault helper
Match the helper to the questionDirect link to Match the helper to the question
| If you need to… | Use |
|---|---|
| Check whether a primary-key value exists | vaultObjectExists |
| Check whether a value exists in a reference column | vaultObjectExistsByRef |
| Retrieve matching records for an exceptional case | vaultObjectFind |
Prefer one of the Boolean existence checks whenever possible. They are simpler and more efficient than retrieving records.
Use exact system and table namesDirect link to Use exact system and table names
Pass the NIM system name, table name, and lookup value as strings. For reference-based helpers, also pass the configured reference-column name.
return vaultObjectExists('hr500', 'employees', '10023963');
Return a safe valueDirect link to Return a safe value
Test the script with records that do and do not have a match. When using vaultObjectFind, always verify the returned array contains a record before accessing its properties.
vaultObjectExistsDirect link to vaultobjectexists
Returns true when a record in the specified table has a primary-key value equal to the lookup value; otherwise returns false.
| Argument | Required | Type | Description |
|---|---|---|---|
| System name | Yes | String | Name of the collected NIM system. |
| Table name | Yes | String | Name of the system table. |
| Lookup value | Yes | String | Primary-key value to find. |
return vaultObjectExists('hr500', 'employees', '10023963');
Use this helper to make a decision based on whether a known object exists—for example, selecting a default value when the expected target object is absent.
vaultObjectExistsByRefDirect link to vaultobjectexistsbyref
Returns true when a row contains the lookup value in the specified reference column; otherwise returns false. The selected column must be configured as a reference key.
| Argument | Required | Type | Description |
|---|---|---|---|
| System name | Yes | String | Name of the collected NIM system. |
| Table name | Yes | String | Name of the system table. |
| Reference column | Yes | String | Reference-key column to search. |
| Lookup value | Yes | String | Value to find in that column. |
return vaultObjectExistsByRef('hr500', 'employees', 'ssn', '999-888-7777');
vaultObjectFindDirect link to vaultobjectfind
Returns an array of records whose reference column matches the lookup value. If there is no match, it returns an empty array.
| Argument | Required | Type | Description |
|---|---|---|---|
| System name | Yes | String | Name of the collected NIM system. |
| Table name | Yes | String | Name of the system table. |
| Reference column | Yes | String | Reference-key column to search. |
| Lookup value | Yes | String | Value to find in that column. |
| Case-sensitive flag | No | Boolean | Whether NIM matches the lookup value case-sensitively. |
const matches = vaultObjectFind('hr500', 'employees', 'ssn', '999-888-7777');
return matches.length > 0 ? matches[0]['FirstName'] : '';
vaultObjectFind can be computationally expensive. Avoid it in high-volume production calculations when an existence check or a filter relation can solve the problem.