Show all attachments in catalog task

Danny Sun
Tera Guru

Hi All,

        We upload attachment in the catalog request item, the attachment will show in the Requested Item form, see the image below, but it can't show in the Catalog Task form. We want to show all the attachments in the catalog task from like the request item form, what should we do?

        img.bmp

Any suggestions I will very appreciate.

Regards,

Danny

1 ACCEPTED SOLUTION

Danny Sun
Tera Guru

Hi All,



I have done this according to Neil's documentation, see it: Request item & task attachment sharing


I just modified some codes, because I want to move the RITM attachment to SC task form, here are my codes:


moveattachments();


function moveattachments() {


      //get all the RITM attachments


      var att = new GlideRecord('sys_attachment');


      att.addQuery('table_sys_id', current.parent.sys_id);


      //gs.log('RITM SYSID='+current.parent.sys_id+"------->"+current.request_item.sys_id);


      att.query();


      while (att.next()) {


              att.table_name = 'sc_task';


              att.table_sys_id = current.sys_id;


              //gs.log('SYSID='+current.sys_id);


              att.update();


      }


}



This will update the RITM attachment to sc task, so the RITM form will not show the attachment list on the top of the form page. The attachment list will show on the top of the sc task form page.




Regards,


Danny


View solution in original post

7 REPLIES 7

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

HI Danny,



Please go through the below link for more info.


» How to Use Defined Related Lists (Relationships) in ServiceNow


Hi Pradeep,



Thanks very much, it is very helpful to me.



Regards,


Danny


Danny Sun
Tera Guru

Hi All,



I have done this according to Neil's documentation, see it: Request item & task attachment sharing


I just modified some codes, because I want to move the RITM attachment to SC task form, here are my codes:


moveattachments();


function moveattachments() {


      //get all the RITM attachments


      var att = new GlideRecord('sys_attachment');


      att.addQuery('table_sys_id', current.parent.sys_id);


      //gs.log('RITM SYSID='+current.parent.sys_id+"------->"+current.request_item.sys_id);


      att.query();


      while (att.next()) {


              att.table_name = 'sc_task';


              att.table_sys_id = current.sys_id;


              //gs.log('SYSID='+current.sys_id);


              att.update();


      }


}



This will update the RITM attachment to sc task, so the RITM form will not show the attachment list on the top of the form page. The attachment list will show on the top of the sc task form page.




Regards,


Danny


Hi Danny Sun,

Your answer is helpful but the attachment is shown in the catalog task page after the task form is updated. Can you please help me how to show attachment before updating the task form.

 

Thanks in advance.

Regards,

Madhuchhanda