
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2020 09:37 AM
Hi,
Is it possible in any way to report on the number of attachments on a form?
Ideally, in a List view i would like a field to say Attachments, and then have the number of attachments of that record or even a true of false.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2020 05:12 AM
I just spotted one more thing that you'll need to change this to an After, which I found worked better.
I also set the Condition line on the Advanced tab to be (so set this for the correct table on each of your Business Rules):
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 07:04 AM
A business rule requires that the data it is referencing is in a database, so until the new record is saved, the scripted functions will not work. And while a "display" business rule will behave similar to an onLoad client script, it would still be looking for entries in a table/database, which requires the data is saved first.
What you are wanting to do is a client side function and will require the use of a Client Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 07:46 AM
Got this part working by creating a new Business Rule but using the actual table (not the attachments table). Still running it after, gave it a lower order number and only using it when insert. Script used as follow:
var count = new GlideRecord('sys_attachment');
count.addQuery('table_sys_id',current.table_sys_id);
count.query();
gs.info('count' + count.getRowCount());
current.u_attachments = count.getRowCount(); //match to integer field name
current.autoSysFields(false); //Don't set the lastUpdatedTime or the Simultaneous Update Alert will likely get triggered
current.setWorkflow(false); //Don't allow other business rules to run, otherwise multiple notifications will likely be sent
task.update();
This way the attachments count will show when a new record is inserted with X numbers of attachments. The other business rule(shown in previous reply) will continue to count when record is updated.
Again thanks for the assistance.