How to return multiple values in Zapier code step

I’m currently creating an automation in Zapier and I need to return several values based on an input condition. At the moment, I can return only one value, but I’d like to return multiple variables at the same time.

Here’s the code I have that works so far:

if (inputData.identifier === 'ABC123-XYZ99') {
  companyName = 'Organization Alpha';
} else if (inputData.identifier === 'DEF456-QRS88'){
  companyName = 'Organization Beta';
}
else {
  companyName = 'Unknown';
}

return {company: companyName};

However, I’m aiming to write something that allows me to return both the company and the training program:

if (inputData.identifier === 'ABC123-XYZ99') {
  companyName = 'Organization Alpha';
  trainingProgram = 'Program One';
} else if (inputData.identifier === 'DEF456-QRS88'){
  companyName = 'Organization Beta';
  trainingProgram = 'Program Two';
}
else {
  companyName = 'Unknown';
  trainingProgram = 'No Program';
}

return {company: companyName, program: trainingProgram};

Am I on the right track for returning multiple variables in Zapier?

totally! ur second code looks solid. just add more props to the return object. i’ve gone this route a bunch and it works perfectly. you can return as many values as u need like this!

You’re doing it right. I’ve used Zapier code steps for years, and returning objects with multiple properties is exactly how you handle this. Quick tip: declare your variables at the top with let or const to avoid scoping issues. Whatever property names you use in your return object become available fields in later steps, so pick names that make sense for your workflow. Your structure will work perfectly - Zapier parses each property as a separate output you can reference later.

Yep, that’s the right approach. I’ve done this in several Zapier workflows and returning multiple values through object properties works great. Zapier treats each property as a separate output variable you can use in later steps. You’ll be able to grab both the company name and training program values independently in your next actions. Just use descriptive property names since they become the field labels when you’re mapping data to other apps.