Requirement related to Work Notes and Attachments

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 10:32 PM
Hi All,
I have few requirements related to Work notes and Attachments:
1. I want to get value of latest work notes, getJournalEntry(1) gives me something like this :
21/10/2024 11:55:23 - Hrithik Nirupam (Additional comments)\n Attachment Alert Sample Payload.txt added\n\
I want only Attachment Alert Sample Payload.txt added, i.e. the value of the work notes not the whole entry.
2. I am sending attachments as base-64 encoded in JSON. Requirement is that if I select multiple files as attachments all at once, what logic should I use in Attachment Table so that I am able to pick the individual files, at the moment I have this logic below to query the attachments:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 11:22 PM - edited 10-22-2024 06:49 AM
Hi @Community Alums
please try it once
var attach = {};
var taskAttach = new GlideRecord('sys_attachment');
taskAttach.addQuery('table_sys_id', incTask.sys_id);
taskAttach.orderBy('sys_created_on'); // Order by created on date
taskAttach.query();
while (taskAttach.next()) {
var fileName = taskAttach.file_name; // Get the file name
var sysId = taskAttach.sys_id; // Get the sys_id for each attachment
attach[fileName] = sysId; // Store in an object for later use
}
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers
Thanks,
Sejal
Thanks & Regards
Sejal Chavan