The CreatorCon Call for Content is officially open! Get started here.

REST Incident eBonding with attachments

John_123_Snow
Mega Expert

I need to do incident eBonding with another ServiceNow instance, so on my business rule I post the incident without attachment.. I get response with the sysID and I need to later use for my Attachment API, because in the Attachment API you need to specify the sysID of the record that has to be attached, hows is this achievable technically? Does it mean that I need to pass the sysID from my response to another post and call the Attachment API from Instance B? 

5 REPLIES 5

Boyan1
Kilo Sage

Hello,

yes, this is exactly what you need to do. Once you have received the response with sys_id, check if there are attachments to the ticket in your instance.

 

If there are attached files, you iterate over them, until you have sent all files to destination system

var grAttachment = new GlideRecord('sys_attachment');
grAttachment.addQuery('table_sys_id', current.sys_id);
grAttachment.query();
while(grAttachment.next())
{
createAttach ( current, grAttachment);
}

In createAttach function you will generate a call to the other ServiceNow instance.

 

Let me know if you have any questions.

Best regards,

Boyan

Sudhanshu Talw1
Tera Guru

Are you using the ebonding spoke or doing via code?

 

Thanks

Sudhanshu

The OOTB Ebonding spoke doesn't send through the attachment associated with the ticket on either side. I believe you will need to add your own REST step.

This may help: https://community.servicenow.com/community?id=community_article&sys_id=5d9cd5addb9d0894d82ffb2439961...

Johnny

ash66
Tera Contributor

I have created my own rest step and the incident ticket is getting attached but I want to a change a field's value which is being sent to the instance B from instance A. But at the same time I don't want to change anything in the instance A. what should I do ?