Ticket Attachment widget not attaching files to record

Cheri M
Kilo Sage

Hello all,

I just started to look into this but thought I'd throw it out there in case anyone else was having issues with this widget.   On existing tickets, when you attach a file via the portal, it does not actually attach to the record.   It does show in the activity (you can click on it there and download) but it's not attached.   Does not show in the header or in the related list nor is in the list of attachments.   If a user goes directly to the record in platform view and attaches, the file is attached to the record.

Has anyone else had this issue and if so, how did you remedy it?   I will continue to look into it but if there is an existing issue it could speed things up.   Maybe I end up on HI.

2017-08-18 11_31_33-Business Services Portal - Ticket Form.png2017-08-18 11_31_24-KBSR0001529 _ ServiceNow.png

Thank you!

Cheri

1 ACCEPTED SOLUTION

This is fixed.   The solution was to clone the simple list widget, then edit the server script to get the sys_class_name and use that for table instead of the table option on the widget.   This then built the URL on portal to the correct table, therefore adding the attachments to the correct table.



I hope this is helpful to someone else!



Cloned widget Server Script:


On line 57 I added: record.table = gr.getValue('sys_class_name'); (line 2 on below example)


On line 92 I edited the record.url where table: record.table (line 1 on 2nd example)



var record = {};


              record.table = gr.getValue('sys_class_name');


              if (data.actions.length > 0) {


                      var fields = gr.getFields();


                      for (var i = 0; i < fields.size(); i++) {


                              var glideElement = fields.get(i);


                              var name = glideElement.getName();


                              if (name.indexOf("sys_") == -1)


                                      record[name] = gr.getValue(name);  


                      }


              }



record.url = {id: options.sp_page, table: record.table, sys_id: record.sys_id, view: view};


View solution in original post

5 REPLIES 5

This is fixed.   The solution was to clone the simple list widget, then edit the server script to get the sys_class_name and use that for table instead of the table option on the widget.   This then built the URL on portal to the correct table, therefore adding the attachments to the correct table.



I hope this is helpful to someone else!



Cloned widget Server Script:


On line 57 I added: record.table = gr.getValue('sys_class_name'); (line 2 on below example)


On line 92 I edited the record.url where table: record.table (line 1 on 2nd example)



var record = {};


              record.table = gr.getValue('sys_class_name');


              if (data.actions.length > 0) {


                      var fields = gr.getFields();


                      for (var i = 0; i < fields.size(); i++) {


                              var glideElement = fields.get(i);


                              var name = glideElement.getName();


                              if (name.indexOf("sys_") == -1)


                                      record[name] = gr.getValue(name);  


                      }


              }



record.url = {id: options.sp_page, table: record.table, sys_id: record.sys_id, view: view};