Split Full Names Without Breaking on Middle Names

Roadblock: your email platform demands First/Last but the form sends "Jane Marie Doe". This handles middle names, single names, and stray spaces.

The Snippet

const parts = (inputData.fullName || "").trim().split(/\s+/);
const firstName = parts[0] || "";
const lastName = parts.length > 1 ? parts[parts.length - 1] : "";
output = { firstName, lastName };

Implementation Steps

  1. Add a Code by Zapier step after your form trigger
  2. Map the full-name field to inputData.fullName

All templates