Skip to content

Instantly share code, notes, and snippets.

@sanbornick
sanbornick / Code.gs
Last active March 6, 2017 23:20
Notify manager upon submission in Google Forms
function onSubmit(e) {
var formResponse = e.response;
var respondant = formResponse.getRespondentEmail();
var user = AdminDirectory.Users.get(respondant);
var userManager, a;
for (a = 0; a < user.relations.length; a++) {
if (user.relations[a].type == 'manager') {
userManager = user.relations[a].value;
}
@sanbornick
sanbornick / code.gs
Last active September 18, 2023 19:45
Dynamic list options in Google Forms.
//Any option added in other by a user who submits the form is then avaialbe in the explicit options for other users.
//This by default acts on all checkbox and multiple choice responses in the form. Make sure each has at least one option
//other than "other" to begin with or else you're gonna have a bad time.
function onSubmit(e) {
var formResponse = e.response;
var itemResponses = formResponse.getItemResponses();
var item, itemAsItemType, choices, choicesStrings, io, response, a, b;
for (a = 0; a < itemResponses.length; a++) {