You need to sign in to do that
Don't have an account?

Saving a external image as an attachment
Hi:
I am trying to save a Google chart (PNG file) that I am displaying with a formula as an attachment to my sObject. Its working fine as a HTML file, but I like to save the actual png file instead. Here is what I have:
my formula field DemoImage2:
IMAGE("http://chart.apis.google.com/chart?chs=250x100&chd=t:60,40&cht=p3&chl=Hello|World", "DemoImage2")
apex code:
Attachment a = new Attachment( parentId = chgCotr.id, name=chgCotr.Name+'.html', body = Blob.valueof(chgCotr.DemoImage2__c ); Database.insert(a);
produces an html attachment with the following markup:
<img src="http://chart.apis.google.com/chart?chs=250x100&chd=t:60,40&cht=p3&chl=Hello|World" alt="DemoImage2" border="0"/>
What I want to save is the source image as png file instead of the <img>markup.
How can I get this accomplished?
Thanks in advance for your suggestions.
Matt
Hi Matt,
If u got the solution, please post it,
i'm also stuck in the same,
Thanks
AB