- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 03:46 AM
hi
we have a requirement, attachments that requester added and parent task's attachments all should be Shown in the child task.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 11:23 AM
You have a couple options:
- Copy the attachments from the parent to the child via the GlideSysAttachment copy method
- Or create a Related List with a relationship between sys_attachment and the child table. See documentation. In the relationship, Applies to table = <your child table> and Queries from table = sys_attachment. Queries with:
current.addQuery('table_name', '<parent table name>');
current.addQuery('table_sys_id', parent.<name of reference field to parent>);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 11:23 AM
You have a couple options:
- Copy the attachments from the parent to the child via the GlideSysAttachment copy method
- Or create a Related List with a relationship between sys_attachment and the child table. See documentation. In the relationship, Applies to table = <your child table> and Queries from table = sys_attachment. Queries with:
current.addQuery('table_name', '<parent table name>');
current.addQuery('table_sys_id', parent.<name of reference field to parent>);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 03:03 AM
hi @Mary9
i need to show the attachments in the parent task that attachments added in child tasks i need solution also for this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 06:27 AM
To show attachments from children on the parent you'd just create another Related List relationship:
Applies to table = <your parent table>
Queries from table = sys_attachment
Queries with:
// Get child task sys_ids
var parentTaskId = parent.getUniqueValue();
var gr = new GlideRecord('<child table name>');
gr.addQuery('<name of reference field to parent>', parentTaskId );
gr.query();
var childTaskIds = [];
while (gr.next()) {
childTaskIds.push(gr.getUniqueValue());
}
// Query attachments on child tasks
current.addQuery('table_name', '<child table name>');
current.addQuery('table_sys_id', 'IN', childTaskIds);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:02 PM
Hi Lakshman,
You can create relationship and show attachments as related list. This will help avoiding duplicating the attachments which may be have some storage size consumption over the period of time.
Check article that I had published some time ago.