Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

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

Tanushree Maiti
Tera Patron

Hi @sonalpriyanka95 

 

For Incident , Just try with Before Insert,Update BR on Interaction Table.

 

(function executeRule(current, previous) {

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

})(current, previous);

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Unforutnately It's still not working

Hi @sonalpriyanka95 

 

Can you share your latest code , 

When to send and script both - both screen shot

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Even in my Script Current.document_id & current.document_table are taking correct value still it's not working