Skip to main content
Participating Frequently
June 12, 2024
Answered

Assistance Required - JavaScript Syntax Error: missing }

  • June 12, 2024
  • 1 reply
  • 1620 views

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."});}

This topic has been closed for replies.
Correct answer Bernd Alheit

Afternoon, 

I use 

cTo: this.getField("Email Address").valueAsString,


This should work.

1 reply

Nesa Nurani
Community Expert
Community Expert
June 12, 2024

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."});}
Participating Frequently
June 12, 2024

Thank you Nesa, appreciate this. will update my script and will respond back shortly.

 

Malo

Participating Frequently
June 12, 2024

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?