- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2022 04:30 AM
getContent() is unable to read the attachment content if the attachment size is more than 5 MB. How to read JSON attachment content as a string if the JSON attachment is more than 5 MB?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 05:13 AM
I have solved the problem using getContentStream() and readLine() of GlideTextReader. I am able to read more than 5 MB of data.
var is = new GlideSysAttachment().getContentStream(attachmentSysId);
var reader = new GlideTextReader(is);
var ln = ' ';
while((ln = reader.readLine()) != null) {
gs.info(ln);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 09:09 PM
Hi,
I believe for that you would require to use mid server as max size to read is 5MB
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 05:13 AM
I have solved the problem using getContentStream() and readLine() of GlideTextReader. I am able to read more than 5 MB of data.
var is = new GlideSysAttachment().getContentStream(attachmentSysId);
var reader = new GlideTextReader(is);
var ln = ' ';
while((ln = reader.readLine()) != null) {
gs.info(ln);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 06:50 AM
Would you mind sharing complete script?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader