- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2024 07:54 AM
Hi there,
I have a issue which I want to fix. It goes about the following thing:
1.) When I use the OOTB "Add attachments" Service Portal form functionality, I can add more than one attachment, and all of these attachments are shown at the Incident in the backend within a ribbon on the top of the Incident, and below in the timeline of the Incident.
Please see screenshots 1, 2 and 3.
2.) When I create a separate attachment field (form variable, type = "Attachment"), I can only upload one attachment per attachment field. Also this attachment is not shown at the Incident in the backend within the ribbon on the top of the Incident. Only below in the timeline the attachment is shown.
Please see screenshots 4 and 5.
My questions:
1.) How can I configure ServiceNow / the Catalog Item, to show all attachments at both places?
2.) How can I upload more than one attachment by using a separate attachment field?
Thanks!
Screenshot 1:
Screenshot 2:
Screenshot 3:
Screenshot 4:
Screenshot 5:
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 07:36 AM
I tried that script, didn't work for me either.
Here's a modified one , this should work.
BR name : Remove ZZ_YY😊
Table : incident
When : After
Insert : true
Script:
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "ZZ_YYsc_cart_item");
gr.addQuery("table_sys_id", current.sys_id);
gr.query();
if (gr.next()) {
gr.table_name = current.getTableName().toString();
gr.update();
}
Just to explain this a bit : When you attach a file to your attachment type field, a record is created in the sys_attachment table with Table Name set to ZZ_YYsc_cart_item. Our business rule is gonna run when the incident is created, and it would query this particular sys_attachment table record, and finally update the Table Name to incident

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2024 11:42 AM
I've been having the same issue this month.
The limitation really is about ServiceNow's attachment type field. It can only hold 1 file. So unless the user takes the pain to zip all his/her files and then attach it, its never going to work as intended.
There is a hack though to make your attached file appear at the record-level or 'at the top of the incident'.
You need a Business Rule that runs before insert of records on the sys_attachment table. The BR should chop off the prefix 'ZZ_YY' in the value under the Table name field.
The reason for doing this is that, anytime you attach a file on an attachment type field, a record is created in the sys_attachment table with the Table name set to ZZ_YY<<your table name>>. Whereas if you attached a file at a record level, this record does not have the ZZ_YY prefix, which is the kind of behavior we like to see everywhere.
Of course, the 'fix' is a global customization. But imho this is absolutely necessary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 12:29 AM - edited ‎08-21-2024 12:29 AM
Thank you @AnirudhKumar!
Do you have an example of that Business Rule script? I have limited scripting knowledge. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 01:05 AM
I created this BR by using the info from the topic here below, but it does not work:
Solved: Disable ZZ_YY prefix from attachment when added th... - ServiceNow Community

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 07:36 AM
I tried that script, didn't work for me either.
Here's a modified one , this should work.
BR name : Remove ZZ_YY😊
Table : incident
When : After
Insert : true
Script:
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "ZZ_YYsc_cart_item");
gr.addQuery("table_sys_id", current.sys_id);
gr.query();
if (gr.next()) {
gr.table_name = current.getTableName().toString();
gr.update();
}
Just to explain this a bit : When you attach a file to your attachment type field, a record is created in the sys_attachment table with Table Name set to ZZ_YYsc_cart_item. Our business rule is gonna run when the incident is created, and it would query this particular sys_attachment table record, and finally update the Table Name to incident