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

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

Community Beginner ,
Feb 27, 2020 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!

TOPICS
Acrobat SDK and JavaScript

Views

714

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 10, 2020 Mar 10, 2020

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

 

Votes

Translate

Translate
LEGEND ,
Feb 27, 2020 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.

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 Beginner ,
Feb 27, 2020 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?

 

 

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

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Feb 27, 2020 Feb 27, 2020

Copy link to clipboard

Copied

Thank you, that looks promising

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 Beginner ,
Mar 10, 2020 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!

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 ,
Mar 10, 2020 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

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Mar 11, 2020 Mar 11, 2020

Copy link to clipboard

Copied

LATEST

Thats perfect, thank you so much! 🙂

 

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