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

akmalkhan
Kilo Explorer

Hi,



My requirement is to copy the attachment from Request or request item to Catalog task.



I created a relationship as below but no luck. Is it anything missing in this.



Name: All Attachments


Applies to table: Catalog task (sc_task)


Queries from table: Attachment (sys_attachment)


Query with:



var qc = current.addQuery('table_sys_id', parent.sys_id);
qc.addOrCondition('table_sys_id', parent.request_item.sys_id);
qc.addOrCondition('table_sys_id', parent.request_item.request.sys_id);
current.addNotNullQuery('table_sys_id');


Hi Akmal,



Not sure if you got an answer yet, but I was looking into this too and I had the same problem, so I thought I'd give you an answer just in case. You need to actually add the field to your form. So right click the header and go "Configure > Form Layout". Then search for the relationship name you created and add it to your form.



Cheers,



Kevin


SC10
Kilo Guru

Where are you placing this code?