populate submitted email subject line with data from livecycle form text field

shirley marotta picture shirley marotta · Oct 24, 2012 · Viewed 9.1k times · Source

I have a pdf form created in Livecycle it is set up with a submit button and will submit a pdf of the form via email.

NOW I want to have the subject line of the email come from on of the filled out fields in the form. for example: client name field will populate the email subject line with whatever is typed into the client name field.

I'd also like to know how I can reduce the file size of the form it's 2mbs currently.

Can anyone help? Thanks in advance.

Answer

bassim picture bassim · Oct 25, 2012

With the ready-to-use Email submit button you can't dynamically set the subject.

However, you can create your own button to submit the form by email and use a script to dynamically set the subject and send the email:

  • drag a regular button into your form,
  • open the script editor for the click event (more info),
  • set the language to JavaScript and
  • use a script like the following:
// Replace with actual path to the field which contains the subject:
var subject = path.to.field.rawValue;

var myDoc = event.target;
try {
    myDoc.mailDoc({
        bUI: false,
        cTo: '[email protected]', // Replace with actual receiver mail address.
        cSubject: subject,
        cSubmitAs: "PDF"
    });
} catch (e) {
    // exception handling...
}

You can find more in-depth information here: http://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address. In this tutorial not the subject but the receiver mail address is set dynamically, but you can apply the same principle to any of the parameters of the doc.mailDoc(...) function.

Regarding your question on how to reduce the file size: either your form is veeery large or you have images with large file sizes embedded in the form. In the latter case search for ways to reduce the image file sizes. For example, check if you are using .jpg or .gif or .png files and not .bmp files (which are uncompressed and hence very large) or use images with a lower resolution (72 dpi is ok for screen display).