Skip to Content
Apr 24, 2017 at 01:20 PM

How to send mail with standard document as an attachment?


Hi Everybody,

Scenario: If sales order release, send a mail (Custom development) to the group of people.

Mail Content:

Body: <Content>

Attachment: If you click preview button in a sales order screen, the standard Sales order confirmation form will open. The same pdf need to send as an attachment.

Sample Code:

//Add attachment 2(pdf)
var FormTemplateLanguage = "E";
var PDF : BinaryObject;
var FormTemplateCode : OutputRequestFormTemplateCode;
FormTemplateCode.content = "C0001"; //Code is Form Template Header Code
// Reuse Service Call
PDF = OutputManagementUtilities.GetPDF(this, FormTemplateCode,"EN");
if (!PDF.content.IsInitial())
  docName = "Sales_Order" ;
  doctype.content = "10001";
  binaryObject = PDF;
  instEmailAttFld.CreateFile(doctype, docName, docAltName, docDesc, binaryObject);

The PDF.content will be empty.

How to send a mail with a standard document? Please help me to solve the issue.


Sankaran A