Sending specific Form fields to different recipients with JavaScript in Adobe Acrobat Pro DC

Feb 27, 2020

Copy link to clipboard

Copied

Hello AS Community,

 

as described in the subject I currently have the following issue:

I want to send the information of specific form fields (e.g. name, last name) to email address A

I want to send the information of other form fields (address, country) to email address B

 

All of that should happen automatically after hitting the created "Submit form" button. 

 

It would be great if the email gets sent automatically (not only opening the email draft)

 

Thanks in advance!

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

this.submitForm({cURL: "mailto:jerry@company.com", aFields:["A","B","C"], cSubmitAs:"XML", cCharSet:"utf-8", });
this.submitForm({cURL: "mailto:larry@company.com", aFields:["D","E","F"], cSubmitAs:"XML", cCharSet:"utf-8", });

 

This script sends two emails. One to Jerry with an XML attachment containing fields A, B, and C.  And one to Larry, who gets an email with an XML  attachment containing fields D, E, and F

 

TOPICS
Acrobat SDK and JavaScript, How to

Views

230

Likes

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

Sending specific Form fields to different recipients with JavaScript in Adobe Acrobat Pro DC

Feb 27, 2020

Copy link to clipboard

Copied

Hello AS Community,

 

as described in the subject I currently have the following issue:

I want to send the information of specific form fields (e.g. name, last name) to email address A

I want to send the information of other form fields (address, country) to email address B

 

All of that should happen automatically after hitting the created "Submit form" button. 

 

It would be great if the email gets sent automatically (not only opening the email draft)

 

Thanks in advance!

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

this.submitForm({cURL: "mailto:jerry@company.com", aFields:["A","B","C"], cSubmitAs:"XML", cCharSet:"utf-8", });
this.submitForm({cURL: "mailto:larry@company.com", aFields:["D","E","F"], cSubmitAs:"XML", cCharSet:"utf-8", });

 

This script sends two emails. One to Jerry with an XML attachment containing fields A, B, and C.  And one to Larry, who gets an email with an XML  attachment containing fields D, E, and F

 

TOPICS
Acrobat SDK and JavaScript, How to

Views

231

Likes

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
Feb 27, 2020 0
Adobe Community Professional ,
Feb 27, 2020

Copy link to clipboard

Copied

Will the form be used by just you (or a small number of users), or would you expect it to work for anyone who manages to obtain the form? You might get something to work for the former, but are unlikely to with the latter.

Likes

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
Reply
Loading...
Feb 27, 2020 1
Feb 27, 2020

Copy link to clipboard

Copied

Thanks for the quick response George,

The form will only be used by a small number of users.

 

I am new to the Javascript world and already managed to write the code that sends the filled out form with the fields "name" and "lastName" in the subject which is exactly what i needed.

 

How can I send selected information to specific email addresses?

 

 

Likes

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
Reply
Loading...
Feb 27, 2020 0
Adobe Community Professional ,
Feb 27, 2020

Copy link to clipboard

Copied

You can do this with a script using the "doc.submitForm()" function.
here's the reference entry:

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_Acro...

 

use the "aFields" argument to set the fields.  

Here's an article on using the "submitForm()" function.

https://www.acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address/

 

Likes

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
Reply
Loading...
Feb 27, 2020 1
Feb 27, 2020

Copy link to clipboard

Copied

Thank you, that looks promising

Likes

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
Reply
Loading...
Feb 27, 2020 0
Mar 10, 2020

Copy link to clipboard

Copied

Hi Thom,

is it possible for you to show me the basic structure of the code? or maybe some more explanations? I should be able to adapt it to my skript then...

 

That would be a huuuge help!!!

 

Thanks in advance!

Likes

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
Reply
Loading...
Mar 10, 2020 0
Adobe Community Professional ,
Mar 10, 2020

Copy link to clipboard

Copied


this.submitForm({cURL: "mailto:jerry@company.com", aFields:["A","B","C"], cSubmitAs:"XML", cCharSet:"utf-8", });
this.submitForm({cURL: "mailto:larry@company.com", aFields:["D","E","F"], cSubmitAs:"XML", cCharSet:"utf-8", });

 

This script sends two emails. One to Jerry with an XML attachment containing fields A, B, and C.  And one to Larry, who gets an email with an XML  attachment containing fields D, E, and F

 

Likes

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
Reply
Loading...
Mar 10, 2020 1
Mar 11, 2020

Copy link to clipboard

Copied

Thats perfect, thank you so much! 🙂

 

Likes

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
Reply
Loading...
Mar 11, 2020 0