Create your own fields with Named Variables

  • 13 April 2021
  • 5 replies
  • 367 views
Create your own fields with Named Variables
Userlevel 3

Have you ever had a Zap that sends a big block of information that you wish you could break apart into separate fields? It turns out you can do just that! I’d like to introduce you to a little known but very powerful Zapier tool called named variables.

Named variables allows you to format your text in a way that when the Zap runs, this text will be separated out and sent as individual fields. The key to using this function is entirely in the formatting of the original information. 

This tool is particularly helpful when you have a big block of text that comes through your Zap in one field, but you’d prefer to use the information in that block of text in different fields in your action step. If we were to send that text formatted with the named variables formatting, the Zap will know to create a separate field with that field name and send through the value in that field.

Let’s look at an example. You have a form on your website that sends you the responses via email. You’d like to add the details of that form entry to your email newsletter service, but the entry arrives in your Zap trigger step like this:

 

f76K7Ec65Ka0-G7g2vd0XWTIObmVaKt7sgiIJbit1g4Zk_fb_b7vEyD-raGxGWrvzJCpTfm7AVGEv8F-HqfDns1oDJLePbK9ec2vjkbHYy_pjy-qlPdHran1h10cPRWjqIsye46Y

 

Now, how do you get the name, the email, the subject, and the message into separate fields in your Zap? You could use Formatter steps to split that block of text, but this could get messy and require a lot of steps to get this text split accurately. A much simpler and all-in-one solution is named variables!

To get this working, we can make a few small tweaks to how that message is sent in your form app, using the syntax for named variables.

This is what that email that sends that format above looks like:

 

ELd3-nFh4Uz-gD3MRvcqS7B4THlrLzme-jrP4YdEMVEAwZmwKSlLjD-EBO6B2wdnSbdG1p0Gvh_VMkKJioNtibLka9_yftKoiqfNNPtBHKzo61AMJbRX63coUE9j-_kSYj9IFJ8P

But, if we make a few tweaks to that email format to use the named variables syntax, we can set it to look like this:

 

jIVqdY4IFykWycyQSTWj-Nw2kwnLipOOxeJkcaMY2zVzW48UcnU8UGQ1hMEmzprKp0HeVs19MML5se35vwm2JEoNA4g06a5fy9u4Zk9hnzWRi7YAQYBtAglJvY6Sm6AEXvnd69DP

 

We’ll see that new formatting in the body of our email, like so:

 

WznlqsoVosowUz4CFv9jNsI6DDrwtZ2SoIt1aWtuF8A-KZzqF_eEd659ltUqC7i_G2EiVC0pIK3ZyZk-QE3eV2cc_cedramBJ_5GfBTTIbSbeaB-5uqFpunWBFndO__1OFX01sal

 

When this entry arrives in our Zap, we’ll get the full block of text and a separate field for each of those variables:

 

q0z4d6YLOZLfL-3Ljcf1AMYN5QSCWkkzyEsat1LW4ADGKYAk7pYq4X51Ctu-F2BJUZddfPUBthEl9l9qrK953jPmqVfayU_wic9w-IW9aScfbrvcNSasNiHsKLHUjnevwNTwLrnG

 

So, with just those few small tweaks we now have four individual fields to use in our Zap, just as we need them.

The named variables syntax is very specific. The structure includes the field name and the value (the information passed in that field). When it’s added to your content, it will look like this:

 

FieldName(Value. Note the value can have multiple words and spaces.)

 

To get this working successfully, we just need to remember a few rules about how to structure your field names:

  1. Use camelCase. This is a coding format that capitalizes the first letter of each word, except the first word in the list. Note that the words are strung together without any spaces between them.

  2. Delete any spaces.

  3. Add only letters, numbers, or underscores.

  4. Put your values in parentheses.

One of the workflows many of our users request is the ability to send out reminder emails about upcoming appointments. Named variables is an excellent way to make this happen.

To do this, we can create two Zaps — the first will set up the appointment in our calendar app, adding all of the information we need using the named variables formatting into the description field:

 

1XkjIKXVRWor2Y-EqOmo3eIXbr7zPlGDVXZlpFvIhNn27K-_57JKyks3BLDiwedbbM5dti5IrTOXtWxEArYMf405z0NKShr6YEWPG2aH6uoNC4IuMhV7_TMN03UOZjhq3vIlvCeA

You’ll see in the description field that we’ve sent through all of the information we received from the form entry using the named variables setup. This detail will then be extracted when we trigger on this information so that we can use these as individual fields in another Zap.

In that second Zap, you’ll see when we get our trigger data from that event in Google Calendar, all of that information formatted with named variables has been separated into distinct fields:

 

IGeAj_20viw8N8x33Z61hJZ0YNjQpVxidIRnbPx6U-4ZiDM6A_WFDc9D0whChWTwU0-uemSp_ZUie02dvt_MzYQTkCzQH1QtqgSmOi_etW6SRHxS1HvqIgp7MvH-3SNH2Kybdunz

 

This allows us to take those separate fields and add them to the corresponding inputs in our send email step:

 

9qIAgEd8uXu5x9lpUnnRt_wgaS6yvEsZoErbcWpiiSuDKkVuyhr466qeUcm5gV2grizd2fPXvt_d_02B5EBNbQgTDAu3pnpphw6Jg5t4EMISo0rZjhYtIuSgUWNXXfBFXVDyif4m

With all of that information in its own field, we can now use that same information to add additional steps, for example, sending a text reminder. You could even add a delay step before that SMS step, so the text reminder goes out the day before the appointment:

 

ZgODwl56D4iIluTG4O0GS6LPvXk9OQCxFjN_uu5m-VjE6EJCSkcnsvFVxbiE50W-3CrBbBm80sPr2IqJ_k0wtjKaJ68Y394EUlMOwMdnHZ6lmLs2YL7Okj_tw_1pufweI37mRmcm

 

This workflow now lets you do a lot more with your information and gives you a lot more power over how it’s sent through your Zaps.

BONUS: One of the other perks of using named variables in your Zaps is that it lets you do this formatting in one step. This means you can split up your text without additional Formatter steps, letting you accomplish your workflow even on our Free plan!

These are just a few of the ways you can use named variables in your Zaps, but the possibilities are endless! What workflows do you currently have in your Zapier account where this could be helpful? I’d love it if you’d share them with me!

 


5 replies

Userlevel 7
Badge +10

Hi @laurie

 

This is such a hidden gem!

Thanks for sharing.

What are some other secret capabilities?

Userlevel 3

@Troy Tessalone All of our built-in tools! I find a lot of people don’t know these exist or how to use them. The lookup table doesn’t get enough love, neither does the pick from list (Formatter > Utilities) though they’re both super-useful for a number of reasons. So, my quest is to start highlighting them. :relaxed:

Userlevel 7
Badge +10

@Troy Tessalone It sounds like my once-upon-a-time idea of an article along the lines of “X things you (probably) didn’t know Zapier could do” could be helpful :)

Userlevel 7
Badge +10

One example of a way to use Named Variables with a Lookup Table:

 

Userlevel 2
Badge

Hi Laurie,

Thanks for the tutorial! This looks super useful to me and I have a Zap where I really could use this, but I’m not sure if I’m understanding this correctly.

I have a Slack Workflow (/w Workflow Builder) for Helpdesk Requests where my users have to fill in a form and the output eventually will be pushed to Github, via the Slack message and some postprocessing in Zapier.

However, to eliminate some cleanup steps in my Zap I’d love to make use of these Named Variables, but I also need to preserve my form output for the Slack message for our bug submitters. Is there a way to have the form output have named variables AND doesn’t look confusing to our bug hunters?

This is the output for the Slack message (last step in workflow) which gets picked up in Zapier (ID: 122052904). Form labels are in Dutch mostly, but from top to bottom:

  • Summary
  • Feedback
  • Priority
  • Submitted by
  • Category
  • URL(s)
  • Screenshot(s)

This ends up in Zapier like so:

 

Thanks for your help.

Reply