Attachment API GET method
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 11:05 PM
Hi All,
I have requirement to edit the existing attachment API on Incident table to get the count of attachments instead of getting the content of the attachment , as currently in the response it is giving the content of the file.
Could you please suggest where i need to edit or search for the attachment API .
I didnt found any details in scripted REST API , REST messages .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 11:57 PM
Hi,
This script would give you the count of attachments on the incident record
var attachment = new GlideSysAttachment();
var agr = attachment.getAttachments('incident', '<record_sys_id>');
var count = 0;
while(agr.next()){
count += 1;
}
gs.info(count);
//count variable will have the number of attachments of your record of interest
If this response was helpful, please leave a thumbs up
Regards,
Bhavani Shankar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2024 08:44 AM
Hello @ServiceNow10sun ,
Please mark my response helpful, if it really helped.
Thanks in advance.
Regards,
Bhavani Shankar