Expand my Community achievements bar.

SOLVED

this.getField error in app.Mail script

Avatar

Level 2

I am having trouble with an app.Mail script I have created in a Lifecycle form.  If I place a this.getField("field_name") line in the script Acrobat Javascript debugger states that the this.getField is not a function.  Also the this.path line returns as undefined in the email message body if bypass the this.getField line.  Perhaps I am mixing up Javascript script and Lifecycle scripting?  If so what needs to be changed for Lifecycle?  I know the app.mail script works without the var lines, but once I add those in is when the problems pop up.  Script listed below.  Thanks!

var cMyMsg = this.path

var Sub = this.getField("Field_Name").value;

app.mailMsg({bUI: true, cTo: "someone@somewhere.com, cSubject: Sub, cMsg: cMyMsg});

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi,

Your script is written using Acrobat JavaScript, whereas because you are working in LiveCycle Designer you need to make the script compatible with the LiveCycle Designer form JavaScript.

The code could be changed to this which works in LiveCycle Designer

var cMyMsg = event.target.path

// Assuming the Field_Name field is in the same subform as the button to run the code

var Sub = Field_Name.rawValue;

app.mailMsg({bUI: true, cTo: "someone@somewhere.com", cSubject: Sub, cMsg: cMyMsg});

Hope this helps

Malcolm

View solution in original post

2 Replies

Avatar

Correct answer by
Level 5

Hi,

Your script is written using Acrobat JavaScript, whereas because you are working in LiveCycle Designer you need to make the script compatible with the LiveCycle Designer form JavaScript.

The code could be changed to this which works in LiveCycle Designer

var cMyMsg = event.target.path

// Assuming the Field_Name field is in the same subform as the button to run the code

var Sub = Field_Name.rawValue;

app.mailMsg({bUI: true, cTo: "someone@somewhere.com", cSubject: Sub, cMsg: cMyMsg});

Hope this helps

Malcolm

Avatar

Level 2

Malcolm,

     That did the trick.  Thank you for showing me the correct script for Lifecycle Designer.