Convert large file into base64 in scope application

RameshwarK
Tera Contributor

Hello,

I am facing issue in rest API, where i need to send request record details with attachment to 3rd party. Attachment needs to send in base64 format. I am able to send attachment if file size less then 5 MB, but if file size is greater the 5 MB payload send empty key. I can't use GlideStringUtil() as this rest API is in scope application. How we can send large file in base64 format in scope application?

 

Appreciate your help!!!!

 

Thanks

11 REPLIES 11

@Ankur Bawiskar 

I check the other links as well but its not working. 

I have check with script include as well but it is giving me error with cross scope.

 

Thanks

@RameshwarK 

did you set Accessible from all scopes for your global script include?

then it should not give cross scope

share the script include config screenshots.

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

@RameshwarK 

check This video

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@RameshwarK 

I was able to get base64 encoded data of 6MB file using the approach I shared

Created script include in global scope, accessible from all scopes

Then invoked it

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Ankur Bawiskar 

Thanks for your time!!

I my case there are some file having 25+ MB size, so I took other approach where now i am sending URL of attachment in rest API.

 

Thanks