Skip to main content
Hoey
Known Participant
January 7, 2019
Answered

Filling form data into email using app.mailMsg

  • January 7, 2019
  • 2 replies
  • 1825 views

Hi! I am trying to pull form data from a PDF document and place it in an email using app.mailMsg - I have a button placed on the page where the data will come from with a mouseup trigger. I've cleaned up the data and email structure that I want to use a few times so I'm not sure if there is an error in my code/syntax (I'll paste below) or it is something that I am completely oblivious to.  Any help is greatly appreciated!  Thank you!

var cMyMsg = "DOEE Notification\n\n"

cMyMsg += "Client Name: " + this.getField("custName").value + "\n";

cMyMsg += "Date Inspected: " + this.getField("inspectionDate").value + "\n";

cMyMsg += "Address: \n";

cMyMsg += "Structure Type: " + this.getField("structureType").value + "\n";

cMyMsg += "Year Built: " + this.getField("yearBuilt").value + "\n";

cMyMsg += "Owner: " + this.getField("buildingOwner").value + "\n";

cMyMsg += "Building Structure Consists of:\n";

cMyMsg += "     *Framing: " + this.getField("typeStudFraming").value + "\n";

cMyMsg += "     *Walls: " + this.getField("typeWalls").value + "\n";

cMyMsg += "     *Floors: " + this.getField("typeFloors").value + "\n";

cMyMsg += "     *Ceiling Height: " + this.getField("maxCeiling").value + "\n";

cMyMsg += "Approx Amt of Visible Mold: ≈" + this.getField("amountMold").value + "\n";

cMyMsg += "Lead and/or Asbestos Testing:\n";

cMyMsg += "     *Lead: " + this.getField("testLead").value + "\n";

cMyMsg += "     *Asbestos: " + this.getField("testAsbestos").value + "\n";

cMyMsg += "Love,\n";

cMyMsg += "Name Here\n";

cMyMsg += "Director of Production & 3rd Degree White Belt\n"

cMyMsg += "DOEE License: 867-5309\n";

app.mailMsg({

  bUI: true,

  cTo: "email@gmail.com",

  cSubject: "DOEE Info",

  cMsg: cMyMsg

});

This topic has been closed for replies.
Correct answer try67

I can't explain what exactly fixed this - I figured I would just retype everything over again into the custom script box within Acrobat DC instead of writing the code in Atom and copying/pasting into Acrobat DC.  Doing that made the code work. 


That suggests there was some kind of character corruption that caused it. My guess would be on the "≈" symbol...

2 replies

Legend
January 7, 2019

Glad you've fixed it. I hate when retyping makes my coding problems go away!

try67
Community Expert
Community Expert
January 7, 2019

The code seems fine. You never really explained what's the issue with it... Is there an error message? If so, what does it say?

Hoey
HoeyAuthor
Known Participant
January 7, 2019

Sorry -  I'm not getting an error message from the document or within Acrobat DC.  I am testing it out on an iPad (iOS 12) using PDF Expert - and within PDF Expert the button shows that I am pressing down on it, but the email window does not come up at all.

I can send/attach the file if that will help in anyway.

I also checked the overall email size and it is well under the 67k byte limit.

Legend
January 7, 2019

Does the email window appear correctly when you test it with Adobe products (those that support it, of course, not Reader)?