Attachment auto convert from any format to blob format

Amit Kumar19
Kilo Contributor

Hi All,

I am trying to auto conversion of attachment file of any format to blob format in Service Portal form but I don't know how it could be done

Can Anyone help in this? It would be more helpful for me

 

 

Thanks

6 REPLIES 6

Nishi4
Tera Contributor

Hi Amit,

Please refer the following link for your reference.

https://stackoverflow.com/questions/33855167/convert-data-file-to-blob

https://developer.mozilla.org/en-US/docs/Web/API/FileReader

 

Please mark as helpful if this solution worked out for you!

 

Thanks,

Nishi

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Amit,

why you want to convert any format to BLOB?

What is the requirement here?

BLOB is a format used at SQL server level for large files.

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello Ankur,

The requirement is to convert the attached files to blob so that we can save it in an oracle database

AbhishekGardade
Giga Sage

Hello Amitkumar,

Checkout this link:

https://docs.servicenow.com/bundle/jakarta-application-development/page/integrate/inbound-soap/refer...

What I have used in my project is as below:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

if (ignore != true && error != true )
{
var StringUtil = GlideStringUtil;
var attachment = new Attachment( );
attachment.write('incident',target.sys_id,source.u_attachment_name,'',StringUtil.base64DecodeAsBytes(source.u_attachement_file));
}

})(source, map, log, target);

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade