Show the list of attachments linked to issues

dev_K
Tera Contributor

Hi All,

 

 

Im trying to create a list to see all the attachments that were created for the Issue table.

I could just go to the sys_attachment table and filter out records for sn_grc_issue table but I also need to see what is the issue that this particular attachment is linked to.

I created a DB view but the issue info is blank:

 

 

dev_K_0-1749136641339.png

as you can see I have the attachment name, its sys ID ant type but I cant see what issue it is related to

 

 

here is the DB view I created:

dev_K_1-1749136719596.png

 

2 REPLIES 2

Muhammad Salar
Giga Sage

Hello,
I think it is the problem of your data etc
I can see these columns with same database view

MuhammadSalar_0-1749150455857.png

 

Bert_c1
Kilo Patron

I agree with Muhammad, I don't have the sn_grc_issue table, but the same DB view for incident attachments works.

 

You can see the same using the following script in 'Scripts - Background':

 

var inc = new GlideRecord('incident');
inc.query();
while (inc.next()) {
	var att = new GlideRecord('sys_attachment');
	att.addQuery('table_sys_id', inc.sys_id);
	att.query()
	if (att.next()) {
		gs.info('inc: ' + inc.number + ' has attachment with file name: ' + att.file_name);
	}
}

replace 'incident' in line 1 with 'sn_grc_issue'.