Skip to main content
Participant
February 27, 2020
Answered

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

  • February 27, 2020
  • 2 replies
  • 1214 views

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!

This topic has been closed for replies.
Correct answer Thom Parker

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

 

2 replies

Thom Parker
Community Expert
Community Expert
February 27, 2020

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_AcroJS%2FDoc_methods.htm%23TOC_submitFormbc-106&rhtocid=_6_1_8_23_1_105

 

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/

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
February 27, 2020

Thank you, that looks promising

Inspiring
February 27, 2020

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.

Participant
February 27, 2020

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?