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

Subject Line Dynamically set from multiple form fields.

New Here ,
Apr 24, 2017 Apr 24, 2017

Hi All, I have a From with 4 fields. 1 text field(Date) and 3 Dropdown fields(Company, Site, and General Ledger). I have a submit button at the bottom that i use to send this form out to several different e-mails addresses. Is there any way that i can make the subject of the email a combination of the 4 fields, as follows: "DATE.COMPANY.SITE.GENERAL LEDGER"?

TOPICS
PDF forms
2.6K
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
1 ACCEPTED SOLUTION
Community Expert ,
Apr 24, 2017 Apr 24, 2017

It shows how to use a dynamic value for the email address. The same principle applies to the subject line.

And combining strings is a basic functionality of JavaScript, which is also shown in that article.

Anyway, you can use this code to achieve what you described:

var mySubjectLine = this.getField("Date").valueAsString + "." + this.getField("Company").valueAsString + "." +

     this.getField("Site").valueAsString + "." + this.getField("General Ledger").valueAsString;

this.mailDoc({cTo: "person1@server.com;person2@server.com", cSubject: mySubjectLine});

View solution in original post

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 ,
Apr 24, 2017 Apr 24, 2017
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 ,
Apr 24, 2017 Apr 24, 2017

try67: I have read the article and do not see where is talks about combining multiple fields into one. Or how to set the Subject so it pulls information from the fields of the 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
Community Expert ,
Apr 24, 2017 Apr 24, 2017

It shows how to use a dynamic value for the email address. The same principle applies to the subject line.

And combining strings is a basic functionality of JavaScript, which is also shown in that article.

Anyway, you can use this code to achieve what you described:

var mySubjectLine = this.getField("Date").valueAsString + "." + this.getField("Company").valueAsString + "." +

     this.getField("Site").valueAsString + "." + this.getField("General Ledger").valueAsString;

this.mailDoc({cTo: "person1@server.com;person2@server.com", cSubject: mySubjectLine});

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 ,
Apr 24, 2017 Apr 24, 2017

i tried your code and it didnt work.

Here is my current code, A hybrid of my old code (which worked but only with a static subject)

I just added in your code for the cSubject.

I am not the best at coding and am pretty sure i have made a mistake or redundancy somewhere.

any heal would be nice.

Thanks

// to address

var cToAddr = "User@Mail.com";

// bcc address

var cBCCAddr = "";

//subject line

var cSubject = this.getField("Date").valueAsString + "." + this.getField("Company").valueAsString + "." +

     this.getField("Site").valueAsString + "." + this.getField("General Ledger").valueAsString

//Body

var cBody = "Thank you for submitting your form.\n" + "Save the mail attachment for your own records";

// to address

var cEmailURL = "mailto:User@mail.com" + cBCCAddr + "&subject" + cSubject + "&body=" + cBody;

this.submitForm({

cURL: cEmailURL,

cSubmitAs:"PDF",

cCharSet:"utf-8"

});

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 ,
Apr 24, 2017 Apr 24, 2017

Both versions should work.

If they don't then specify what happens, especially if there are any error messages in the JS Console.

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 ,
Apr 25, 2017 Apr 25, 2017

There is no error message. Nothing happens when the submit button is clicked

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 ,
Apr 25, 2017 Apr 25, 2017

Can you share the file in question with us, via Dropbox/Google Drive/Adobe Cloud/etc.?

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 ,
Apr 25, 2017 Apr 25, 2017

Yes i can share it. On google drive

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 ,
Apr 25, 2017 Apr 25, 2017

Then do it and post the link to it here, please.

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 ,
Apr 25, 2017 Apr 25, 2017
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 ,
Apr 25, 2017 Apr 25, 2017

There are errors in the JS Console... Click the Submit button and then press Ctrl+J to see them.

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 ,
Apr 25, 2017 Apr 25, 2017
LATEST

I figured it out. I cant believe it but i forgot to name the fields on the form. the were still called dropdown1\2\3 so it wasnt working.

THanks for all of your help!

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 ,
Apr 25, 2017 Apr 25, 2017

This Code Works (but will only give me a static Subject Line):

// to address

var cToAddr = "User@comp.com";

// bcc address

var cBCCAddr = "User@comp.com";

// subject line

var cSubLine = "Completed PO Form submitted";

// Body

var cBody = "Thank you for submitting your form.\n" + "Save the mail attachment for your own records";

var cEmailURL = "mailto:User@comp.com?Bcc=" + cBCCAddr + "&subject=" + cSubLine + "&body=" + cBody;

this.submitForm({

cURL: cEmailURL,

cSubmitAs:"PDF",

cCharSet:"utf-8"

});

This code does not work(The only difference is the subject line) :

// to address

var cToAddr = "user@comp.com";

// bcc address

var cBCCAddr = "user@comp.com";

// subject line

var cSubLine = this.getField("Date").valueAsString + "." + this.getField("Company").valueAsString + "." +

     this.getField("Site").valueAsString + "." + this.getField("General Ledger").valueAsString;

// Body

var cBody = "Thank you for submitting your form.\n" + "Save the mail attachment for your own records";

var cEmailURL = "mailto:User@comp.com?Bcc=" + cBCCAddr + "&subject=" + cSubLine + "&body=" + cBody;

this.submitForm({

cURL: cEmailURL,

cSubmitAs:"PDF",

cCharSet:"utf-8"

});

I know that i must be making a stupid error but i can not see it. Any help would be appreciated.

THanks

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