+ Start a Discussion
ai501.3910110299805757E12ai501.3910110299805757E12 

Want to attach Generate xml file as attachment with button click

I am a having an external system which accepts xml file. I need a vf page with custom button after clicking button it must be added to "notes and attachments" and view and download xml file after some days. 

Ashish_SFDCAshish_SFDC
Hi , 


Both are different tasks, Generating XML file and Adding an attachment to a record, 


See the below links for saomple code for Genarating XML file in APEX, 

How to generate XML file using Apex class

https://developer.salesforce.com/forums?id=906F000000093KBIAY

apex program to create and download a file

http://salesforce.stackexchange.com/questions/9295/apex-program-to-create-and-download-a-file

A better way to generate XML on Salesforce using VisualForce

http://it.toolbox.com/blogs/anything-worth-doing/a-better-way-to-generate-xml-on-salesforce-using-visualforce-55433


Upload a file as an Attachment to a record using Visualforce

http://www.forcetree.com/2011/02/upload-file-as-attachment-to-record.html

Uploading an Attachment using Visualforce and a Custom Controller

http://blog.jeffdouglas.com/2010/04/28/uploading-an-attachment-using-visualforce-and-a-custom-controller/


Regards,
Ashish