+ Start a Discussion
Cool_DevloperCool_Devloper 

Using MailMerge Templates in Attachments

Hello Friends,

 

I am facing an issue with creating attachments where i dynamically create the body using some list of records which have a summarized information. I am doing this with APEX code.

 

The issue here is that, the attachment type i am creating is a Word Doc and the content which gets rendered as part of the attachment body comes in a very poor display as i cannot format it in the code.

 

So, i tried using a MailMerge Template, so that i can then plug-in the data into this template which will look better. But somehow, when i add my contents into the template and create an attachment, it starts giving an error, that file format is corrupted etc....

 

Is there something which i am missing? Or, can someone give me some ideas on how can i achieve this apart from using MailMergeTemplates??

 

I need a generic solution to this ..... Would be great if someone can help me out here!!

 

Many Thanks,

Cool_D

SlanganSlangan

Mailmerge sounds like a good solution for your needs.

 

Can you give more information about the error and the code you are using in the

template? Are you using the SF mailmerge tool in MS Word to add your mergefields?

What type of information are you merging? I know Word will not merge a document with

line items in it if those line-items are not in the same table or collumn. In the past that

has given me the error you mentioned below. 

 

Right now my best guess is that there is a syntax error somewhere in a line item

that is causing Word to give you the error you mentioned, but I need more information

to be sure.