Insert/Send multiple attachments through REST API in scoped application

Sharique Azim
Mega Sage

Hi All,

I am posting this here as i couldn't find sufficient information over the internet.

Requirement:

Integration of two servicenow instance to send and recieve multiple attachments on INCIDENT module.

Problem Summary:

Of the two ,one instance is having incident in scoped application, thus most of the global scripts(OOB) are duplicated in scope to facilitate the smooth operations. The latter one may or may not be in scope.

Now as we are aware REST is itself in global application(Correct me if I am wrong),thus most of the functionality are not going to work. Stating that,we can say basic scripts syntax like GlideSysAttachment might not work. 

So,

1. How to make implement that functionality,i.e Sending and inserting attachment on the target incident on the other instance.Please provide a code snippet or reference URLs if you can, for better understandings.

2. Also, which method should we use Data Serialization or Data Streaming.

 

Any more tips on best practice or experience is also welcomed.

Thanks in advance.

 

Regards,

Shariq

1 ACCEPTED SOLUTION

hello sorry for the late reply,

i took help from the saveResponseBodyAsAttachment function from the docs, which easily helped on every insert.

View solution in original post

3 REPLIES 3

rahulpandey
Kilo Sage

Hi Shariq,

 

 - You can have scoped scripted rest so, yes rest can be scoped object.

- Send array of base64 objects from one instance and them iterate through each array and attach to same incident.

- Use attachmentcreator topic of ecc_queue and isnert the attachment.

refer

http://www.john-james-andersen.com/blog/service-now/generate-attachments-in-servicenow-via-rest.html

hello sorry for the late reply,

i took help from the saveResponseBodyAsAttachment function from the docs, which easily helped on every insert.

Can you help me in same 

 

https://community.servicenow.com/community?id=community_question&sys_id=0d7ea301db8f6f005d782183ca961990