Skip to main content
Inspiring
September 16, 2020
Answered

Adding Subject Line text to Javascript code

  • September 16, 2020
  • 1 reply
  • 1100 views

Hi,

I have been using the below code, which I found on this community, to alert required fields which works fine when all is good and the email pops up it is missing the subject line, can anyone help with the Javascript to add text to the Subject Field

 

Thanks in advance

Paul

 

var emptyFields = []; for (var i=0; i<this.numFields; i++) { var f= this.getField(this.getNthFieldName(i)); if (f.type!="button" && f.required ) { if (f.defaultValue==f.valueAsString) emptyFields.push(f.name); } } if (emptyFields.length>0) { app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n")); } else this.mailDoc({cTo: "Colette.Williams@sjp.co.uk"});

This topic has been closed for replies.
Correct answer try67

Change this:

{cTo: "Colette.Williams@sjp.co.uk"}

To:

{cTo: "Colette.Williams@sjp.co.uk", cSubject: "Message subject goes here"}

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 16, 2020

Change this:

{cTo: "Colette.Williams@sjp.co.uk"}

To:

{cTo: "Colette.Williams@sjp.co.uk", cSubject: "Message subject goes here"}

PerivanPAuthor
Inspiring
September 16, 2020

Thats Brilliant much appreciated as always