I'm currently trying to use Martin Hawksey's Google Apps event manager from his blog, but I am running into 2 problems.
#1) The date in the conformation emails is posting the "today's" date & time instead of the event date & time (it's in his original and he never fixed it). Most are saying has to do with this section not being right:
var variableData = isDate(data[normalizeHeader(templateVars[i])]);
email = email.replace(templateVars[i], variableData || "");
}
return email;
}
// Test if value is a date and if so format
function isDate(sDate) {
var scratch = new Date(sDate);
if (scratch.toString() == "NaN" || scratch.toString() == "Invalid Date") {
return sDate;
}
else {
return Utilities.formatDate(new Date(), TZ, "dd MMM yy HH:mm");
}
}
#2) My other issue is in the template for joining instructions I can't call-to any variables (i.e. ${"Invoice"} or ${"Amount"} :: instead it returns "today's" date <-- I added more cells and added a column for each and they have data in them, and made correct adjustments in the script; still nothing.
ex.
Template: "Your Invoice # is: ${"Invoice"} and your total amount due is: ${"Amount"}"
Reality: "Your Invoice # is: 13 Feb 13 13:18 and your total amount due is: 13 Feb 13 13:18."
Here is my full script and changes I made (not too different from his original): https://gist.github.com/hakarune/4985606
Any and all help would be very much appreciated, the biggest and most important thing is that date though.... Thanks you