The getLookupCacheData helper reads a value from a lookup cache and inserts it in your Handlebars template. A lookup cache is an account-level store of reusable data. Unlike the lookup helper, which can read only lookups defined on the same flow step, getLookupCacheData can read any lookup cache registered to the integration.
Syntax
{{getLookupCacheData _lookupCacheAliasID key pathToValue defaultValue}}
_lookupCacheAliasID -- The alias ID of the lookup cache to read. Required. Always wrap the alias ID in double quotes.
key -- The key of the record to read in that cache. Required. Pass a field path, or a hard-coded string in double quotes.
pathToValue -- The path of one value inside the record, in dot notation. Optional. Omit it to return the whole record. When the value at that path is an object, the helper returns the JSON text of the object. Use a numeric index for an array item, such as projects.0.name.
defaultValue -- The value to return when the key or the path does not match. Optional. Omit it and the helper returns an empty string when nothing matches. Wrap a hard-coded default in double quotes.
Examples
The examples below read a lookup cache whose alias ID is 65548203b. The cache holds this record under the key 101:
{
"firstName": "John",
"lastName": "Doe",
"age": 30,
"position": "Software Engineer",
"department": "Engineering",
"salary": 80000,
"address": {
"street": "123 Tech Street",
"city": "Codeville",
"country": "USA"
},
"projects": [
{ "name": "ProjectA", "status": "In Progress" },
{ "name": "ProjectB", "status": "Completed" }
]
}
Return a top-level value
{{getLookupCacheData "65548203b" "101" "firstName"}}
Output: John
Return a nested value
{{getLookupCacheData "65548203b" "101" "address.city"}}
Output: Codeville
Chain field names with dots to read a value inside a nested object.
Return a value from an array
{{getLookupCacheData "65548203b" "101" "projects.0.name"}}
Output: ProjectA
projects.0 is the first item in the projects array. name is the field on that item.
Return an object as JSON text
{{{getLookupCacheData "65548203b" "101" "address"}}}
Output:
{"street":"123 Tech Street","city":"Codeville","country":"USA"}
The path points at an object, so the helper returns that object as JSON text. Use triple braces so the quotes in the JSON are not encoded.
Pass the key from a field
{{getLookupCacheData "65548203b" record.employeeId "firstName"}}
Input:
{ "record": { "employeeId": "101" } }
Output: John
Leave the key unquoted when it is a path in the source record. Quote it only when you hard-code the key.
Supply a default when nothing matches
{{getLookupCacheData "65548203b" "999" "firstName" "Unknown"}}
Output: Unknown
Key 999 is not in the cache. The fourth argument is returned instead of an empty string.
Usage notes
- The alias ID is always a quoted string.
key,pathToValue, anddefaultValueneed quotes only when you hard-code them. - A missing key or path returns an empty string unless you pass
defaultValue. - Omit
pathToValueto return the whole cached record. An object comes back as JSON text, the same way a path that points at an object does. - Use triple braces when the result is JSON text, so quotes in the output are preserved.
-
lookupreads a lookup configured on the current flow step.getLookupCacheDatareads a lookup cache by its alias ID, including caches registered elsewhere in the integration.