Copy link to clipboard
Copied
I have wititen this script however, I am getting the following Sytax error: missing } after property list 4 at line 5
see the script below:
{app.alert("Before sending to PC for review, admins please review the following, -Travel Application Details -Cost Breakdown -Private Travel Plan",3)
var cAlert=app.alert("are we ready to send to PC for review?",3,2)}
this.mailDoc({cTo: this.getField("Email Address"), cCc: "manager@email.com",
cSubject: "Travel Application+this.getField("FullName TravellersRow1").valueAsString+this.getField("City 2").valueAsString+this.getField("Departure Date").valueAsString",
cMsg: Please see the attached for your review and complete the 'Travel Justification'section. Refer to the form with a yellow box labeled ' Send to Admin', click the box and this will auto-generate an email back to the admin. admin will then process the rest of your application and progress to the Manager and Assistant Executive Director for review, sign-off, and approval."});}
Copy link to clipboard
Copied
There are several syntax errors, I have also added new line for first alert for easier review and condition to second alert to send mail only if answer to alert is "Yes" (let me know if that works for you):
app.alert("Before sending to PC for review, admins please review the following:\n- Travel Application Details\n- Cost Breakdown\n- Private Travel Plan", 3);
var cAlert = app.alert("Are we ready to send to PC for review?", 3, 2);
if (cAlert == 4) {
this.mailDoc({
cTo: this.getField("Email Address").valueAsString,
cCc: "manager@email.com",
cSubject: "Travel Application " + this.getField("FullName TravellersRow1").valueAsString + " " + this.getField("City 2").valueAsString + " " + this.getField("Departure Date").valueAsString,
cMsg: "Please see the attached for your review and complete the 'Travel Justification' section. Refer to the form with a yellow box labeled 'Send to Admin', click the box and this will auto-generate an email back to the admin. Admin will then process the rest of your application and progress to the Manager and Assistant Executive Director for review, sign-off, and approval."});}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
This should work.
Copy link to clipboard
Copied
There are several syntax errors, I have also added new line for first alert for easier review and condition to second alert to send mail only if answer to alert is "Yes" (let me know if that works for you):
app.alert("Before sending to PC for review, admins please review the following:\n- Travel Application Details\n- Cost Breakdown\n- Private Travel Plan", 3);
var cAlert = app.alert("Are we ready to send to PC for review?", 3, 2);
if (cAlert == 4) {
this.mailDoc({
cTo: this.getField("Email Address").valueAsString,
cCc: "manager@email.com",
cSubject: "Travel Application " + this.getField("FullName TravellersRow1").valueAsString + " " + this.getField("City 2").valueAsString + " " + this.getField("Departure Date").valueAsString,
cMsg: "Please see the attached for your review and complete the 'Travel Justification' section. Refer to the form with a yellow box labeled 'Send to Admin', click the box and this will auto-generate an email back to the admin. Admin will then process the rest of your application and progress to the Manager and Assistant Executive Director for review, sign-off, and approval."});}
Copy link to clipboard
Copied
Thank you Nesa, appreciate this. will update my script and will respond back shortly.
Malo
Copy link to clipboard
Copied
Hello Nesa, thank you so much! this worked wonders!.
I have one question, I have highlighted this in yellow for you, in the form I have created a text field so the users can enter their email addresses into them. however this does populate the email address I tested (see the other attachment for the error) and actually stops the email from being generated the minute I removed this field it and made it" ", it works fine, however the 'To' Field is just blank and the 'Cc' field works., is it becuase I need to format this field to generate email?
Copy link to clipboard
Copied
Do you use:
cTo: this.getField("Email Address").valueAsString,
or:
cTo: this.getField("Email Address"),
Copy link to clipboard
Copied
Afternoon,
I use
cTo: this.getField("Email Address").valueAsString,
Copy link to clipboard
Copied
This should work.
Copy link to clipboard
Copied
the Emaill Address field I have used in the form is a text field is that the correct field to use to enter email addresses into or does the test field need to be formatted using script?
Copy link to clipboard
Copied
Thank you Nesa and Bernd, both your assistance has helped, I went back and review my script and decided to save and exit. upon doing so it somehow refreshed what I have inputted in there and has since worked. I will now continue and complete this form. again your help has been much appreciated.
Malo