Skip to main content
Inspiring
January 14, 2016
Question

Set file name when using an email button.

  • January 14, 2016
  • 1 reply
  • 591 views

I have a invoice with an email button that will use to email a copy to my customers.

But when the attachment is sent the file name is random numbers and letters, not the same file name as the original pdf.

Is there a command that I can put in my script that will take data from the from (Invoice and Date) and use it for the file name when it sends the email?

This is the script I am using.

// Collect the Customer's Email Address

var cToAddr = this.getField("Email").value;

// Set the subject and body text for the email message

var cSubLine = "Paperwork"

var cBody = "Here is your paperwork."

// Send the first page as a file attachment in an email

var page0 = this.extractPages(0); 

page0.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody});  page0.closeDoc(true);

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
January 14, 2016

Since I wrote this code for you I'll chime in (PS. In the future it's better to ask follow-up questions in the original thread, instead of opening a new one).

The answer is that without installing a script on the local machine of the user it's not possible to change the file name, not automatically at least.

You can always prompt the user to save the file before submitting it, though.

Inspiring
January 14, 2016

Thank you,

In case anyone also has a problem with the random numbers and letters in the file name...it was because I had a space in the original file name.

try67
Community Expert
Community Expert
January 14, 2016

What happens when you remove the space?