Creating reference numbers with Zapier

Zapier has a number of hidden little tricks up its sleeve. Here’s one I discovered the other day when helping Art For Cure with their artist submissions.

The challenge

Art for Cure is a Suffolk-based charity who raise money for breast cancer research. Every year they hold a large exhibition featuring hundreds of artists. Curating and gathering the information from artists can be time-consuming and in the past they’ve had no real way to easily reference each piece of art across different spreadsheets, web links, emails and in-person conversations.

The solution

Zapier to the rescue! I worked with the Art for Cure team to create a new Master Google Sheet that captured information from a Typeform. In the middle sits a tidy little Zap that:

  • Processes the form information into a Google Sheet
  • Creates a unique short reference number for the submission (code below)
  • Emails the artist with confirmation of the reference number

Now this is in place, everyone can use the simple reference number to know which piece of work needs addressing (lots of things can change in the run-up to the each exhibition; price, dimensions etc.)

The code

This is a pretty straightforward bit of code, but using Zapier’s built code block functions allows me to capture the unique ID from the Typeform submission, and add the artist’s initials to create a simple unique reference. At the end I’ve given the option to just return the artist initials and reference, or have the ability to append a three digit number at the end.


{
  // Get the Typeform ID, strip it down to x chars
  let ref_number = inputData.ref_number.slice(-5).toUpperCase();
  
  // Generate a random three digit number for the suffix
  var suffix = Math.floor(Math.random() * (999 - 100 + 1) + 100);
  
  // Take the name, split it down to initials
  const ref_initials = inputData.ref_initials
   .split(" ")
   .map(word => word && word[0].toUpperCase())
   .join("");
  
  // Create an artist reference
  var artist_reference = ref_initials + "-" + ref_number;
  
  // Add the suffix
  var artist_reference_suffix = artist_reference + "-" + suffix;
  
  // Return it as a usable value -  would look like JK-ADG3F-123
  return { artist_reference_suffix };
}

And that’s it! Pretty straightforward Javascript with the added power of Zapier.

This post was written by James Kindred

Oh, hey! I’m James Kindred - a graphic designer in Suffolk, UK, and I run Fork: a creative consultancy for start-ups and scaling brands. With over 25 years of experience, I work with start-up and scale-up brands to develop their identity, collateral and brand strategy.

To top