The CreatorCon Call for Content is officially open! Get started here.

save xml as attachment ?

Kumar35
Tera Expert

hi there!
any pointers to store the xml of current record as a related attachment record in attachments table ?

cheers!

5 REPLIES 5

adiddigi
Tera Guru

There is actually a very simple way, Here is the way you can do it:




var xml = '<xml>'+
'<number>'+current.number+'</number>'+
'<state>'+current.state+'</state>'+
'</xml>';
var attachment = new Attachment();
var attachmentRec = attachment.write('incident', current.sys_id, "record.xml", "text/xml", xml);
gs.addInfoMessage('An attachment is created with sys_id and attached to this incident'+ attachmentRec);



This is the idea.