Advanced lookup table tips: multiple outputs and reusing across Zaps

  • 14 July 2021
  • 0 replies
  • 178 views
Advanced lookup table tips: multiple outputs and reusing across Zaps
Userlevel 6
Badge +2
  • Zapier Staff
  • 20 replies

Hello! Tim here from Zapier’s Premier Support Team with another workflow tip for you!

Lookup Tables are a very useful part of the Formatter by Zapier app. They’re a utility action that can help you convert between different types of data you want to relate, like human readable names and record IDs for just one example.

Lookup Tables are also a great alternative to Paths in many cases. Nick has a great writeup about that here.

To build on the Lookup Table’s usefulness, we’ll look at two advanced workflows in this post.

Multiple Outputs

Lookup Tables take 1 input and provide 1 output with a default to fall back on. Have you ever wanted to lookup 1 input but get multiple outputs? We could use multiple Lookup Tables or a Google Sheet Find Row search, but there’s another way. By combining a single Lookup Table with a different Zapier feature called Named Variables, we can get more than 1 output from our Lookup.

Named variables work almost everywhere in Zapier (with one exception being inside of line items), so let’s try them out in a Lookup Table. Let’s say I wanted to look up an employee from a list of employee ID’s I was getting from my Trigger and I wanted to get the first name and email address of those employees.

Here’s what the Lookup Table Step would look like:

 

In this example, I’ve got 2 employees which could be looked up. I’ve set up the Named Variables in each potential output of the Lookup Table the same way, with a “name” and “email” value.

When I test this Step it looks up the line that contains the key “15” and gives me the following result:

 

I’ve only set up 2 named variables here, and 2 items that could be looked up, but you can add more of either.

With this one Lookup Table, I now have all the info I’d need to send a personalized email to employee “Tim”. Because all the info is stored in the Zap, I don’t have to worry about maintaining an external document like a Google Sheet for managing the Lookups.

Reusing Lookup Tables

Have you ever had a Lookup Table set up in one Zap that you’d like to be able to use in another one and easily keep the two Lookup Tables in sync so they work the same way?

In the past, we’d probably again suggest Google Sheets for an “external Lookup Table”, but we can now use Sub Zap by Zapier to create a reusable Lookup Table instead.

Here’s what a Lookup Table wrapped in a Sub Zap Trigger and Action looks like at a high level:

 

First, we define in the Start a Sub Zap Trigger a single input field. It can be called anything and I’ve named it “lookup key” for clarity:

 

Looking at the Lookup Table Step again, we can see that I’ve used the Lookup Key value we defined in the Trigger to be what we’re looking up in the field of the same name:

 

Finally, in the “Return from a Sub-Zap” Action, we’ve defined the output values we want to send back to the Zap that calls the Sub Zap: 

 

To summarize, we can take a lookup key value from any Zap that calls this Sub Zap, put that through the same Lookup Table each time, and then return 1 or more output values back to the Zap that called it.

This can turn your Sub Zap Lookup Tables into an easily reusable part of your Zaps, and because they’re all using the same Table, they’re easy to keep up to date if you need to make changes.

Here’s another Zap where I’m using the Sub Zap Lookup Table Zap that we just built:

 

I’ve added the “Call a Sub Zap” Action, selected the Sub Zap that contains our Lookup Table, and fed in the value that I want to Lookup.

When we test the “Call a Sub-Zap” action in our second Zap, we can see that it runs the other Zap and then returns the results from the Lookup Table:

 

Hope you find this useful and let us know if you have any questions about these workflow tips!


0 replies

Be the first to reply!

Reply