Decode base64 field and add to record as attachment

rcard11
Tera Guru

I have a field on a case form that is populated with a base64 value.  I would like to take that string and convert it back into an image and attach that image to the case.  Has anyone had any success in doing this?  Thank you in advance for your help!

10 REPLIES 10

Hi @gabez 

Change

var agr = attachment.write( rec, fileName, contentType, base64Encodedcontent);

  to 

 

var agr = attachment.writeBase64( rec, fileName, contentType, base64Encodedcontent);