Attachment count!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2011 11:07 AM
Hi on kb_knowledge table i have created a field called attachment counter (this field will be counting the number of attachment to particular article.)
Any idea how to do this.I am thinking of making after isert/update b.Rule.
var att = new GlideRecord("sys_attachment");
att.addQuery("table_name","kb_knowledge");
what else :-)....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2017 04:40 AM
Hi Prerna,,
Try with Business rule on kb_knowledge table with the below code..
var count = new GlideRecord('sys_attachment');
count.addQuery('table_sys_id',current.sys_id);
count.query();
gs.log('count' + count.getRowCount());
current.u_attachment_count = count.getRowCount();
current.update();
Regards,
Sadasiva
Please mark helpful/ correct based on the impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2017 04:37 AM
Hi,
Try with Business rule on kb_article table with the below code..
var count = new GlideRecord('sys_attachment');
count.addQuery('table_sys_id',current.sys_id);
count.query();
gs.log('count' + count.getRowCount());
current.u_attachment_count = count.getRowCount();
current.update();
Regards,
Sadasiva
Please mark helpful/ correct based on the impact