Copy link to clipboard
Copied
I am new to writing Java Scripts and trying to write one that will change a subject line based on a selection of a drop down list.
There error I get is I am getting is: "SyntaxError: Missing ) after condition 3 at line 4"
Attached is the whole script that I have so far.
Can someone help?!
Copy link to clipboard
Copied
To be clear, this is the updated "if" statement
if ( cToAddr == "Site NOT Ready North: DispatachNewServicesNorth") {
Copy link to clipboard
Copied
The script is missing quotes around the text in the "if" statement on line #3.
However, the if condition is incorrect. It needs to use the variable that was set to the field value "cToAddr", to compare to the quoted string.
Copy link to clipboard
Copied
Thank you so much! I think I have it working now!
Copy link to clipboard
Copied
In the future please share code only as text, not as an image. It makes it much more difficult to debug it that way.
Copy link to clipboard
Copied
Thank you for that tip. First time post! Here was the code
var cToAddr = this.getField("DropdownEmail").valueAsString;
if ("DropdownEmail" == Site NOT Ready North: DispatachNewServicesNorth) {
var cSubLine = this.getField("Service Address_2").valueAsString + " " + "Not Ready";
} else {
var cSubLine = "Trying this out";
}
var cBody = "Notification" + " " + this.getField("Notification#").valueAsString + "-" + this.getField("Service Address_2").value;
this.mailDoc({
bUI:true,
cTo:cToAddr,
cSubject:cSubLine,
cMsg:cBody
});
I had changed the the If statement to add extra quotes as suggested as above and appears to be working now! Appreciate the help!
Copy link to clipboard
Copied
To be clear, this is the updated "if" statement
if ( cToAddr == "Site NOT Ready North: DispatachNewServicesNorth") {