Skip to main content
Participant
December 17, 2024
Question

New to Javascript - Cannot get form to open/email via outlook

  • December 17, 2024
  • 1 reply
  • 541 views

Hi all,  

 

I have combed a ton of articles on this subject and I am hitting walls with every attempt.  I have a simple fillable form I built and want to submit the entire PDF to an email with custom subject line and reflect the attached document name.  (Just using the submit form option send a renamed pdf to the email just fine but a generic subject line.)

I am using the following javascript and have tried a few other examples.  Nothing comes up in the console with errors but outlook does not open to send the email.  If I open in a browser I get a popup that asks if I want to send to the email in question but it opens a new tab in chrome what does nothing. If I open in MS Edge it tabs back to chrome but does not open a tab... WHere am I going wrong?

Any help is appreciated!  I have a few forms I am updating to be useful like this so I am motivated to learn this!

var cToAddr = "me@email.com";
var cSubLine = "Facilities Work Request"+" "+this.getField("Location").valueAsString;

this.mailDoc
({bUI: true,
cTo: cToAddr,
cSubject: cSubLine})


File I am working with attached.
 

This topic has been closed for replies.

1 reply

PDF Automation Station
Community Expert
Community Expert
December 17, 2024

It works for me.  Do you have this setting:

 

 

Participant
December 17, 2024

Thanks for confirming.  I came back from lunch and it's working!  I must have incorrectly saved or something on the previous attempts.  I was able to add the things I needed and it's working as intended now.  

Is there a reason why using this from a browser does not work?  Chrome still opens a blank tab and edge opens chrome but does not open a tab... Not a deal breaker but it would be nice if this worked via app AND browser...

var cToAddr = "mail@server.com";
var cSubLine = "Facilities Work Request"+" - "+this.getField("Location").valueAsString;
var cBody = "Work Order attached for"+" - "+this.getField("Location").valueAsString+" From "+this.getField("Submitted By:").valueAsString+"\n"+"Description of issue: "+this.getField("Description").valueAsString;

this.mailDoc
({bUI: true,
cTo: cToAddr,
cSubject: cSubLine,
cMsg: cBody})
PDF Automation Station
Community Expert
Community Expert
December 18, 2024

Non-Adobe pdf viewers are hit and miss with the scripts they support.  Most likely a miss with this script.