Need help with sending a pdf form to specific people based on the given input

Community Beginner ,
Jun 08, 2018

Copy link to clipboard

Copied

This is scenario that I'll be working on:

The company that I am working for has thousands and thousands of procedures of varying length (in terms of the number of pages). For example, lets assume
that a procedure in 15 pages long. So, at the very beginning of the procedure will require the supervisor initials and then procedure will be sent out for
completion, and, once the procedure is complete, it'll be sent back to the supervisor. I will create a submit option at the end of the procedure,
which will be linked to the supervisor's email.

So, what I wanted to know if there is a way where based on the initials of the supervisor at the beginning of the document, the
"submit" tab at the end will be linked automatically to the corresponding supervisor.
Suppose there are 10 supervisors (1-10). Once supervisor 5 has input his initials at the beginning, supervisor 5's email address will be automatically linked to the "submit" tab. So, when the "submit" option is clicked, the procedure will be
emailed to supervisor 5. Is there a way this can be done?

By the way, I do have access to Adobe Acrobat Pro.

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Both. Let's say you have a text field called Initials and a Submit button.

You can use the following code as the Mouse Up script of the latter:

var initials = this.getField("Initials").valueAsString;

if (initials=="SA") this.mailDoc({cTo: "simon.a@server.com"});

else if (initials=="JD") this.mailDoc({cTo: "john.doe@server.com"});

else if (initials=="JS") this.mailDoc({cTo: "john.smith@server.com"}); // etc.

else this.mailDoc({cTo: "default_email@server.com"});

If you want it's even possible to not submit the file is the field is empty, and alert the user that they must enter their initials first.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

107

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

Need help with sending a pdf form to specific people based on the given input

Community Beginner ,
Jun 08, 2018

Copy link to clipboard

Copied

This is scenario that I'll be working on:

The company that I am working for has thousands and thousands of procedures of varying length (in terms of the number of pages). For example, lets assume
that a procedure in 15 pages long. So, at the very beginning of the procedure will require the supervisor initials and then procedure will be sent out for
completion, and, once the procedure is complete, it'll be sent back to the supervisor. I will create a submit option at the end of the procedure,
which will be linked to the supervisor's email.

So, what I wanted to know if there is a way where based on the initials of the supervisor at the beginning of the document, the
"submit" tab at the end will be linked automatically to the corresponding supervisor.
Suppose there are 10 supervisors (1-10). Once supervisor 5 has input his initials at the beginning, supervisor 5's email address will be automatically linked to the "submit" tab. So, when the "submit" option is clicked, the procedure will be
emailed to supervisor 5. Is there a way this can be done?

By the way, I do have access to Adobe Acrobat Pro.

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Both. Let's say you have a text field called Initials and a Submit button.

You can use the following code as the Mouse Up script of the latter:

var initials = this.getField("Initials").valueAsString;

if (initials=="SA") this.mailDoc({cTo: "simon.a@server.com"});

else if (initials=="JD") this.mailDoc({cTo: "john.doe@server.com"});

else if (initials=="JS") this.mailDoc({cTo: "john.smith@server.com"}); // etc.

else this.mailDoc({cTo: "default_email@server.com"});

If you want it's even possible to not submit the file is the field is empty, and alert the user that they must enter their initials first.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

108

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
Jun 08, 2018 0
Most Valuable Participant ,
Jun 08, 2018

Copy link to clipboard

Copied

Yes, it's possible. The tricky part is identifying the initials. It would be best if you could use a text field for it, instead of a comment.

If you do that then it's a trivial if-else statement that can be placed before the submit command.

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...
Jun 08, 2018 2
Community Beginner ,
Jun 08, 2018

Copy link to clipboard

Copied

try67​ I am planning of using text field. Are you referring to the portion where the supervisor would put his initials or where the "submit" tab would be? Also, if you provide with the script or instruction on how to implement this, I would really appreciate it. Thanks

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...
Jun 08, 2018 0
Most Valuable Participant ,
Jun 08, 2018

Copy link to clipboard

Copied

Both. Let's say you have a text field called Initials and a Submit button.

You can use the following code as the Mouse Up script of the latter:

var initials = this.getField("Initials").valueAsString;

if (initials=="SA") this.mailDoc({cTo: "simon.a@server.com"});

else if (initials=="JD") this.mailDoc({cTo: "john.doe@server.com"});

else if (initials=="JS") this.mailDoc({cTo: "john.smith@server.com"}); // etc.

else this.mailDoc({cTo: "default_email@server.com"});

If you want it's even possible to not submit the file is the field is empty, and alert the user that they must enter their initials first.

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...
Jun 08, 2018 2
Community Beginner ,
Jun 08, 2018

Copy link to clipboard

Copied

try67​ wow, this tool is really powerful. THANK YOU SO MUCH! That's exactly what I needed. Regarding what you mentioned at the end, how can I alert the used if the initial field in left blank?

Once again, thank you very 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...
Jun 08, 2018 0
Most Valuable Participant ,
Jun 08, 2018

Copy link to clipboard

Copied

You can add this line as the first if-condition:

if (initials=="") app.alert("You must first fill in the Initials field before submitting the form!",1);

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...
Jun 08, 2018 1
mbabu001 LATEST
Community Beginner ,
Jun 12, 2018

Copy link to clipboard

Copied

try67

I was wondering if you would be able to help me out. I wanted to automatically insert the date and the time once the signature field has been filled [image shown below]. How can I do that? What script should I use? Thanks

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...
Jun 12, 2018 0