How to use Snippets for Id Lookups

Depending on the emails you’re sending or systems you are integrating with, you frequently have a value but need to find the id (or vice versa) from a static list. With‘s Snippets, you can use Liquid Logic to lookup a list of ids and their corresponding values.

For this example, we’re going to demonstrate how you can lookup an Account Executive’s calendar link. Without Snippets, you can use Attribute updates to add these values for each user. Using Snippets for lookups, you can keep your user’s profile clean of unnecessary or redundant information.

Create a Structured Snippet

In your workplace setting, you will find the Snippets section. Snippets are global variables that can serve static information universally in any email, message, or other workflow action in your workspace.

Since we want to be able to programmatically read from this Snippet, we’ll create an array of JSON objects. The format should be similar to the below:

    "name":"Abby Abelseon",
    "name":"Bobby Bobson",
    "name":"Charlie Charleston",

By creating an array, we’ll be able to loop through the Snippet to find the exact record you’re looking for.

Use a Liquid for Loop

Once you’ve created your Snippet, you can use it in any workflow item. Imagine you have an onboarding series (like we do!) that includes a call out for the Account Executive assigned each user. You may also want to include the AE’s calendar link in their signature. With the structured Snippet we created above, it’s easy to find the calendar link of a specific AE using the following Liquid for loop.

{% for user in snippets.users %}{% if == %}{{user.calendar_link}}{% endif %}{% endfor %}

Note – This example expects that each user has an AE attribute that matches a name in the Snippet we made.

This liquid is going through each object in our Snippet (the JSON object is what is included in a set of curvy brackets {}), and then checks if the name field matches the attribute of the given user. Once it finds the object that matches, it returns the calendar_link.

Structured Snippets are a powerful way of enriching the data available to you without adding unnecessary attributes to your customer’s profiles.

Join our mailing list for updates on our content and more!