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

how to submit to email with specific fields in subject line?

New Here ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

I've got a pdf created with a submit button. it works, but I would like to collect information in a field of the PDF and include it in the subject line of the email.

Ex: I need to collect the Users name field to be included in the subject line of the email.

Is this possible?

TOPICS
PDF forms

Views

14.7K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Mar 16, 2018 Mar 16, 2018

OK, then remove the Submit Form command you added to the button and add a Run a JavaScript command instead, with this code:

var targetEmail = "me@server.com";

var subjectLine = this.documentFileName + " " + this.getField("First").valueAsString + " " + this.getField("MI").valueAsString + " " + this.getField("Last").valueAsString;

this.mailDoc({cTo: targetEmail, cSubject: subjectLine});

Of course, change the target email address in the first line to the actual one you want to use.

Votes

Translate

Translate
Community Beginner ,
Nov 07, 2023 Nov 07, 2023

Copy link to clipboard

Copied

Thank you, I'll try there.

Votes

Translate

Translate

Report

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 ,
Dec 07, 2019 Dec 07, 2019

Copy link to clipboard

Copied

Ah. Thank you! I was putting them all in separate quoatation marks.

Votes

Translate

Translate

Report

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 ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

I have tried the same above per instruction(I am submitting the whole sheet) and it does nothing once I have modified the script with my field names. I do have required fields for all 3 fields in my code below:

 

var targetEmail = " bryanc@xxx.com;?cc=jamiem@xxx.com;heathers@xxx.com";

var subjectLine = this.documentFileName + " " + this.getField("Unit Number").valueAsString + " " + this.getField("Ordered by").valueAsString + " " + this.getField("Order Date").valueAsString;

var body = "Please fill out form completely and with as much information as you can. Thanks.\nThis is a new line of text.";

this.mailDoc({cTo: targetEmail, cSubject: subjectLine, cMsg: body}):

 

What am I missing?

 

Votes

Translate

Translate

Report

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 ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

The CC address(es) needs to be specified using the cCc parameter. Also, drop the space at the start of the targetEmail variable. And check the JS Console for errors once you run the code.

Votes

Translate

Translate

Report

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 ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

Thanks. That was it!

Votes

Translate

Translate

Report

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 ,
Nov 07, 2023 Nov 07, 2023

Copy link to clipboard

Copied

Hi Try67,

 

I have tried a few combinations and the javascript does not work for me.

 

var targetEmail = "XXX@sever.com";

var subjectLine = this.documentFileName + " " + this.getField("Change No.").valueAsString + " " + this.getField("Permit Holder (Supervisor of the Work").valueAsString + " " + this.getField("Last").valueAsString;

var body = "The permit has been signed off.\nThis is a new line of text.";

this.mailDoc({cTo: targetEmail, cSubject: subjectLine, cMsg: body});

 

What am I missing?

Votes

Translate

Translate

Report

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 ,
Nov 07, 2023 Nov 07, 2023

Copy link to clipboard

Copied

Check the JavaScript console for errors.

Votes

Translate

Translate

Report

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
Explorer ,
Feb 21, 2024 Feb 21, 2024

Copy link to clipboard

Copied

Hi Try67 (i know your name from previous encounters, but I am not sure I should use it here.

I have adapted the basic script in this string to get the proper subjectline based on my form. I can also add a body line, but I would like it to appear before the actual form, rather than at the end of the body of the email. (In this case the message is "Here is my application. Thank you." 

 

See images. Is there a way to do this? Thanks, Stuart

Votes

Translate

Translate

Report

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
Explorer ,
Feb 21, 2024 Feb 21, 2024

Copy link to clipboard

Copied

Actually, I still have a bit of a problem because when I open the pdf, it immediately gives me a box to send an email before I have actually completed the form....How do I fix that?

 

Votes

Translate

Translate

Report

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
Explorer ,
Feb 21, 2024 Feb 21, 2024

Copy link to clipboard

Copied

Try this:

va targetEmail = "pacifictransportationassoc@gmail.com";
var subjectline = this.documentFileName + " " + this.getField("PTA Membership Application Renewal form").valueAsString + " " + this.getField("Name 1").valueAsString;
var body = "Here is my completed application. Thank you";
this.mailDoc({cTo: targetEmail, cSubject: subjectLine, cMsg: body});

Votes

Translate

Translate

Report

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
Explorer ,
Feb 21, 2024 Feb 21, 2024

Copy link to clipboard

Copied

hmm, I get an error message...

Votes

Translate

Translate

Report

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
Explorer ,
Feb 23, 2024 Feb 23, 2024

Copy link to clipboard

Copied

This script works to add the form to the outgoing email and adds the proper subject line.  I guess I can dispense with the message in the body.  But my problem is this:  I open the document the first thing that happens is a cue to send email, before the form opens to allow people to fill it in.

 

This will be distributed to people and they should not confront this confusing email message until they have seen and completed the form. How can I eliminate that first email box and open the form directly?

 

 

//------------------------------------------------------------- //-----------------Do not edit the XML tags-------------------- //------------------------------------------------------------- //<Document-Level> //<ACRO_source>Email Response</ACRO_source> //<ACRO_script> /*********** belongs to: Document-Level:Email Response ***********/ var targetEmail = "pacifictransportationassoc@gmail.com"; var subjectLine = "PTA Membership Application Renewal from " + this.getField("Name 1").valueAsString; var body = "Enter the message body here.\nThis is a new line of text.";

this.mailDoc({cTo: targetEmail, cSubject: subjectLine, cMsg: body}); //</ACRO_script> //</Document-Level>

Votes

Translate

Translate

Report

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 ,
Feb 23, 2024 Feb 23, 2024

Copy link to clipboard

Copied

You need to place the script somewhere else, then. What do you want to trigger it?

Votes

Translate

Translate

Report

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 ,
Feb 23, 2024 Feb 23, 2024

Copy link to clipboard

Copied

PS. Do NOT edit the code via the Edit All JavaScripts window! You can seriously mess up your file if you do.

Votes

Translate

Translate

Report

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
Explorer ,
Feb 23, 2024 Feb 23, 2024

Copy link to clipboard

Copied

I'm sorry, I don't know enough about this to understand your answer. I created a document java script, but then I don't know how to apply this script to a button...I see no way to select this particular script. ANd I am not even sure this it the right way to do it.

It might be better if you can point me to some sort of tutorial, rather than try to go back and forth with this, given my limited knowledge.

Votes

Translate

Translate

Report

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
Explorer ,
Feb 23, 2024 Feb 23, 2024

Copy link to clipboard

Copied

I want them to click on the link associated with the line that says "email this completed form...."

 

Votes

Translate

Translate

Report

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 ,
Feb 23, 2024 Feb 23, 2024

Copy link to clipboard

Copied

Remove the code from the doc-level script and place it under the Action of your Link object. It's that simple.

Votes

Translate

Translate

Report

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
Explorer ,
Feb 23, 2024 Feb 23, 2024

Copy link to clipboard

Copied

LATEST

Worked!...thanks.

 

 

Votes

Translate

Translate

Report

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