copy sctask attachments - to rtim

nameisnani
Mega Sage

Hi Team ,

 

can anyone please help me on this requiement .

 

Ony for particular catalog item ' Snow Support ' 

 

whenever in sctask we have attached any attachment . the same to should copy to ritm .

 

how to configure , can any one please help me .

 

@Ankur Bawiskar  Please help me here 

11 REPLIES 11

SD_Chandan
Kilo Sage

Hi @nameisnani ,

You can refer this solution :-
https://www.servicenow.com/community/itsm-forum/how-to-copy-attachment-from-sctask-to-ritm/m-p/70126...

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.



Thank you
Chandan

Bhavya11
Kilo Patron

Hi @nameisnani ,

 

Try below

Create Business rule :

Table - sc_task
When to Run - Before Update
Condition - item is Snow Support 
Scripts -

 

 

(function executeRule(current, previous /*null when async*/ ) {
    // Add your code here{
        GlideSysAttachment.copy('sc_task', current.getUniqueValue(), 'sc_req_item', current.request_item);
})(current, previous);

 

 

Thanks,

BK

 

@Bhavya11 

 

 I have tested - attachment is not copying 

can you try this

BR: after insert on sys_attachment

Condition: current.table_name == 'sc_task

 

var taskRec = new GlideRecord('sc_task');

taskRec.addQuery('sys_id', current.table_sys_id);

taskRec.query();

if(taskRec.next()){

var ritmRec = new GlideRecord('sc_req_item');

ritmRec.addQuery('sys_id',taskRec.request_item);

ritmRec.query();

if(ritmRec.next()){

GlideSysAttachment.copy('sc_task', current.table_sys_id, 'sc_req_item', ritmRec.sys_id);

}

}