Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Attachments from INteraction are not getting copied to Incident

sonalpriyanka95
Giga Expert

Earlier Attachments from Interaction are not getting copied to Incident  or RITM , however then I had created an BR which run after insert in Interaction_related_record table which works fine for RITM however still not working for Incident.

 

(function executeRule(current, previous /*null when async*/) {

// Add your code here
if (current.document_table == 'incident')
{
    var inc = new GlideRecord('incident');

    inc.addQuery('sys_id',current.document_id);
    gs.info('Document Table: ' + current.document_id);
    inc.query();

    if (inc.next())
    {
    GlideSysAttachment.copy('interaction', current.interaction, 'incident', inc.sys_id);
    }
}
else if (current.document_table == 'sc_request'){
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request',current.document_id);
ritm.query();

if (ritm.next()){
GlideSysAttachment.copy('interaction', current.interaction, 'sc_req_item', ritm.sys_id);
}
}
})(current, previous);
1 ACCEPTED SOLUTION

I just now made few changes in your script  user After Insert & update

 

(function executeRule(current, previous) {

    if (current.interaction && current.task)
    {
    var att = new GlideSysAttachment();
    att.copy('interaction', current.interaction, 'incident', current.task);
    }

})(current, previous);
 
Then It Worked , thanks for you Support

View solution in original post

5 REPLIES 5

I just now made few changes in your script  user After Insert & update

 

(function executeRule(current, previous) {

    if (current.interaction && current.task)
    {
    var att = new GlideSysAttachment();
    att.copy('interaction', current.interaction, 'incident', current.task);
    }

})(current, previous);
 
Then It Worked , thanks for you Support