Javascript not defined error for dynamic email address generation from dropdown selection
Below javascript not working for cTo address but does work for cCc address. Error is "undefined." I am a newbie to writing javascript but researched this one to death and used a billion variations. This script is the only one that had no syntax errors. Where might the trouble be? My goal is to have the submit button send to first email if fulltime faculty is selected and to second email if any other item in dropdown is selected. I tried and else only statement and it failed. So I went with multiple if else statements. I also tried inequality ( != ) operator which also was a syntax error. Please advise! Thanks!
var DropdownPositionType = this.getField("DropdownPositionType").valueAsString;
if (DropdownPositionType === "Fulltime Faculty") {
event.value = "user@university.edu";
} else if (DropdownPositionType === "Graduate Assistant") {
event.value = "User2@university.edu";
} else if (DropdownPositionType === "Fulltime Staff") {
event.value = "User2@university.edu";
} else if (DropdownPositionType === "Parttime non student") {
event.value = "User2@university.edu";
}
var cCCAddr = this.getField("HiringManagerEmail").value;
var cSubLine = "Lorem ipsum dolor sit amet.";
var cBody = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.";
this.mailDoc({
bUI: true,
cTo: cToAddr,
cCc: cCCAddr,
cSubject: cSubLine,
cMsg: cBody
});
