Synchronize attachments between Case and Incident

Christophe
Tera Contributor

Our customers created case via the web portal. Our engineers work in the incident. All the updates that should be visible for the customer are synchronized between case and incident. When a customer adds an attachment to the case, it is not visible in the incident. How can I make this work? I checked the forum and the documentation, but was not really able to find a solution. Thank you in advance for your help!

1 ACCEPTED SOLUTION

My pleasure and please start working on scripting by joining the developer's learning on https://developer.servicenow.com.

Kindly,mark the answer as correct if this helps you out so,this questions could be considered as closed for other community members.

Regards,

Munender

View solution in original post

21 REPLIES 21

Hi Chris,

I know this would add to your efforts,but as adding an attachment is not an update on the record so,our bR is not triggering hence,we have to do it this way:

1.Write a business rule on sys_attachment table

2.The type of business rule is after and action is on insert/update

3.When to run -->table name is case

4.Script would be:

var gr = new GlideRecord('case');
gr.addQuery('sys_id',current.table_sys_id);
gr.query();
if(gr.next()){

var incGr = new GlideRecord('incident');
incGr.addQuery('u_case', gr.sys_id);
incGr.query();

if(incGr.next())
{

GlideSysAttachment.copy('case', gr.sys_id,'incident', incGr.sys_id);
incGr.update();
}
}

 

Hope this would help you out as I have tested this on my instance.Please feel free to contact me if any issues.

 

Regards,

Munender

Thank you very much for your help Munender! Very nice of you. I have no experience with scripting, so I was very happy with your help.

Btw. Just as a reply for your "no experience with scripting". In Madrid you can actually do this without a single line of scripting with a flow instead. Pre Madrid you need to create a own custom action for the copy. Actually showing both ways (custom action or Baseline Action in Madrid) in another case here if you want to see: Episode 15 - Copy Attachment to outbound mail - YouTube

//Göran
Feel free to connect with me:
LinkedIn & Twitter
Subscribe to my YouTube Channel
Buy The Witch Doctor's Guide To ServiceNow

My pleasure and please start working on scripting by joining the developer's learning on https://developer.servicenow.com.

Kindly,mark the answer as correct if this helps you out so,this questions could be considered as closed for other community members.

Regards,

Munender

I defenitely will! I think I have to check some other things by the way, because on my Instance the attachments are still not copied. Our instance is running on Kingston, can this be the problem?