Hi Mithun,
your code looks correct regarding the generation of a PDF.
However, you have to add the binaryobject created to the Attachment object in code too.
We use the following code:
var ATTACHMENT_TYPE_DOCUMENT : DocumentTypeCode;
ATTACHMENT_TYPE_DOCUMENT.content = "10001";
if (this.AttachmentFolder.DocumentList.Where(n => n.AlternativeName == documentAlternativeName).Count() == 0) {
// create PDF
var FormTemplateLanguage = "E";
var FormTemplateCode : OutputRequestFormTemplateCode;
FormTemplateCode.content = SOLUTION_ID + "_SUFFIX";
var pdfDocument = OutputManagementUtilities.GetPDF(this, FormTemplateCode, FormTemplateLanguage);
if (!pdfDocument.content.IsInitial()) {
Trace.Info("document successfully created");
if (!this.ItemAttachmentFolder.IsSet()) {
Trace.Info("attachment folder not existent, thus create it");
this.AttachmentFolder.Create();
}
var description : Description;
description.content = "";
description.languageCode = LanguageCode.ParseFromString("EN");
this.AttachmentFolder.CreateFile(ATTACHMENT_TYPE_DOCUMENT, documentName, documentAlternativeName, description, pdfDocument);
}
}