Customizing an email Subject line with field from .pdf form
Copy link to clipboard
Copied
I found a couple of discussions that previously described how to do this using Java script which I am not fluent in. I tried to use the commands as given but I'm getting an error message when I try to save the instructions in Adobe Acrobat. I code I used was:
var emailSubject = "Certificate " + TextField1.rawValue + ".pdf";
event.target.mailDoc({
bUI: false,
cTo: to,
cCC: cc,
cSubject: emailSubject,
cMsg: emailMsg,
cSubmitAs: "PDF"
});
The error message I get is Reference error: invalid assignment left-hand side 1: at line 2 (and it highlights line 2)
Any thoughts as to what I am doing incorrectly and how to fix?
Thanks.
var emailSubject = "Certificate " + TextField1.rawValue + ".pdf";
event.target.mailDoc({
bUI: false,
cTo: to,
cCC: cc,
cSubject: emailSubject,
cMsg: emailMsg,
cSubmitAs: "PDF"
});
Copy link to clipboard
Copied
Is this an Acrobat form or a LiveCycle Designer form?
Copy link to clipboard
Copied
Acrobat
Copy link to clipboard
Copied
Then change this line:
var emailSubject = "Certificate " + TextField1.rawValue + ".pdf";
To:
var emailSubject = "Certificate " + this.getField("TextField1").valueAsString + ".pdf";
Copy link to clipboard
Copied
Also, change this:
event.target.mailDoc
To:
this.mailDoc
And I don't see where you've defined, the "to", "cc" and "emailMsg" variables...
Copy link to clipboard
Copied
And drop this line:
cSubmitAs: "PDF"
Copy link to clipboard
Copied
I am still having the same problem with line 2. Ideas?
Copy link to clipboard
Copied
Post your current full code and the exact error message you're getting.
Copy link to clipboard
Copied
Current code:
var emailSubject = "New Submission - Treasure Management Implementation Checklist - " + this.getField("ClientName1).value
this.mailDoc({
bUI: false,
cTo: "tmpilot@firstrepublic.com",
cSubject: emailSubject,
cMsg: New form
})
message:
SyntaxError: unterminated string literal 1: at line 2
Copy link to clipboard
Copied
String have to be in quotes. Change this:
cMsg: New form
To:
cMsg: "New form"

