Attachments arrive differently in backend Incident form, from out of the Service Portal?

AdamUMC
Giga Guru

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:

AdamUMC_0-1724165164351.png


Screenshot 2:

AdamUMC_1-1724165212518.png


Screenshot 3:

AdamUMC_2-1724165301733.png

 

AdamUMC_3-1724165372842.png


Screenshot 4:

AdamUMC_4-1724165441926.png



AdamUMC_6-1724165494993.png


Screenshot 5:

AdamUMC_7-1724165579751.png

 

1 ACCEPTED SOLUTION

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

View solution in original post

6 REPLIES 6

Thanks @AnirudhKumar!
This works very well. One last question: this solution works for every Catalog Item / Record Producer, which has it's output to a Task (like Incident)?

The script is dynamic enough to fix all Task records, but not the trigger.

Our BR runs only on incident record insert... So this solution applies only to incidents. We could set the table on the BR to Global, that should apply the fix everywhere. But a part of me says that's stretching too much.