Build a conditional intake-form router
Send long Northwind forms only to relevant respondents based on short pre-survey answers.
Published Sep 15, 2025
Northwind’s intake form tried to cover everyone — new clients, existing clients, vendors — in one long questionnaire. The result was a form so padded with “skip this section if it does not apply” instructions that respondents gave up halfway through, and the team got patchy answers from everyone.
This script splits intake into two steps. A short pre-survey asks only one thing: who are you? Based on that answer, the script emails the respondent a link to the right detailed form — and nothing else. Each person sees a form built for them, so it is shorter, clearer, and gets finished.
What you’ll need
- A short Google pre-survey form with two questions: an email field and a “Who are you?” multiple-choice question whose options match the routes below.
- Three (or more) detailed Google Forms — one per respondent type — and their shareable links.
- Edit access to the pre-survey form, so you can attach the submit trigger.
The trigger
// Each pre-survey answer mapped to the detailed form it should send.
const ROUTES = {
'New client': 'https://forms.gle/NEW_CLIENT_FORM',
'Existing client': 'https://forms.gle/EXISTING_CLIENT_FORM',
'Vendor': 'https://forms.gle/VENDOR_FORM',
};
// The exact titles of the two questions the script reads.
const ROLE_QUESTION = 'Who are you?';
const EMAIL_QUESTION = 'Email';
/**
* Runs on every pre-survey submission. Reads the respondent's role and
* email, then sends them the matching detailed form.
*/
function onFormSubmit(e) {
// 1. Pull the answers out of the submission by question title.
const role = e.namedValues[ROLE_QUESTION] && e.namedValues[ROLE_QUESTION][0];
const email = e.namedValues[EMAIL_QUESTION] && e.namedValues[EMAIL_QUESTION][0];
// 2. Bail out if either answer is missing — nothing to route.
if (!role || !email) {
Logger.log('Missing role or email — skipping.');
return;
}
// 3. Look up the detailed form for this role.
const next = ROUTES[role];
if (!next) {
Logger.log('No route for role: ' + role);
return;
}
// 4. Email the respondent the link to their tailored form.
GmailApp.sendEmail(email, 'A few more details', `Continue here: ${next}`);
}
How it works
onFormSubmitruns automatically whenever someone submits the pre-survey, thanks to the form-submit trigger you attach below.- The event object
ecarriesnamedValues, a map of question title to the answers given. The script reads the role and email by their question titles. - If either answer is missing it logs the reason and stops — no email goes out for an incomplete submission.
- It looks the role up in the
ROUTESmap. An unrecognised role (a mismatch between the form options and the map keys) is logged and skipped. - If a route is found,
GmailApp.sendEmailsends the respondent a short message with the link to their detailed form. - The respondent only ever receives the one form that applies to them, so the long all-in-one questionnaire is never needed.
Example run
Someone fills in the pre-survey:
| Who are you? | |
|---|---|
| [email protected] | Vendor |
On submission, the script matches Vendor in ROUTES and sends:
To: [email protected] Subject: A few more details Body: Continue here: https://forms.gle/VENDOR_FORM
A respondent who picks “New client” instead gets the new-client form link, and
a respondent whose answer is not in ROUTES gets nothing — the run just logs
“No route for role”.
Trigger it
This must run on a form-submit trigger attached to the pre-survey:
- In the Apps Script editor, open Triggers (the clock icon).
- Click Add trigger.
- Choose
onFormSubmit, set the event source to From form, and the event type to On form submit. - Approve the authorisation prompt — the script needs permission to send email on your behalf.
Watch out for
- The
ROUTESkeys must match the form’s multiple-choice options exactly, including capitalisation and spacing. A mismatch silently drops the respondent into the “no route” path. namedValueskeys are the question titles. Rename a question on the form andROLE_QUESTIONorEMAIL_QUESTIONmust change to match, or the lookup returns nothing.- If the email question is not a real email field, a typo in the address means the routing email bounces and the respondent is stuck. A required email-type question reduces this.
GmailApp.sendEmailcounts against your daily Gmail send quota (500 for a consumer account, more for Workspace). A burst of pre-survey submissions can hit the limit.- The trigger must be attached to the pre-survey form, not the detailed forms. Attaching it to the wrong form means nothing routes.
- Respondents can ignore the follow-up email. The script sends the link but cannot make anyone open it — chase non-responders separately if intake completion matters.
Related
Trigger an onboarding sequence on form submit
Kick off tasks when a new Northwind hire submits their starter form.
Updated Oct 17, 2025
Build a content-submission queue
Collect Northwind guest posts or ideas for review through a Form.
Updated Oct 9, 2025
Score sentiment in open-text feedback
Rate Northwind feedback comments without manual review — using the in-Sheet sentiment function.
Updated Oct 5, 2025
Build a peer-nomination and voting system
Collect and tally Northwind nominations for awards or initiatives — one ballot, anonymous.
Updated Oct 1, 2025
Roll a form over each cycle
Archive old responses and reset for the next Northwind cycle — quarterly OKR check-ins.
Updated Sep 27, 2025