Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Customizing an email Subject line with field from .pdf form

New Here ,
Jan 15, 2019 Jan 15, 2019

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"  

            });

TOPICS
Create PDFs
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2019 Jan 15, 2019

Is this an Acrobat form or a LiveCycle Designer form?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 15, 2019 Jan 15, 2019

Acrobat

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2019 Jan 15, 2019

Then change this line:

var emailSubject = "Certificate " + TextField1.rawValue + ".pdf";

To:

var emailSubject = "Certificate " + this.getField("TextField1").valueAsString + ".pdf";

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2019 Jan 15, 2019

Also, change this:

event.target.mailDoc

To:

this.mailDoc

And I don't see where you've defined, the "to", "cc" and "emailMsg" variables...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2019 Jan 15, 2019

And drop this line:

cSubmitAs:  "PDF"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 15, 2019 Jan 15, 2019

I am still having the same problem with line 2. Ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2019 Jan 16, 2019

Post your current full code and the exact error message you're getting.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2019 Jan 17, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2019 Jan 17, 2019
LATEST

String have to be in quotes. Change this:

cMsg: New form

To:

cMsg: "New form"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines