- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2015 03:41 AM
Hi guys, i have task to copy an attachment from an incident, from one instance to a change request in another instance using soap web services. Can anyone help me on this.
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2015 12:55 AM
hi guys i found the solution
used these two to finish the code GlideStringUtils, GlideSysAttachment
revised code:
var StringUtil = new GlideStringUtil();
var attachments = new GlideSysAttachment();
var fileName, contentType;
var gR = new GlideRecord('sys_attachment');
gR.addEncodedQuery('table_name=incident^table_sys_id='+current.sys_id);
gR.query();
while(gR.next()){
try {
var binData = attachments.getBytes(gR);
var encData = StringUtil.base64Encode(binData);
gs.log('XML Respons for payload='+encData);
var s = new sn_ws.SOAPMessageV2('Copy attachments', 'insert');
s.setStringParameter('source', 'change_request:'+current.u_change_sysid);
s.setStringParameter('payload', encData);
s.setStringParameter('topic', 'AttachmentCreator');
s.setStringParameter('agent', 'AttachmentCreator');
s.setStringParameter('name', gR.file_name+':'+gR.content_type);
var response = s.execute();
var responseBody = response.getBody();
var status = response.getStatusCode();
}
catch(ex) {
var message = ex.getMessage();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 12:22 PM
Hi Dinesh, I'm having the problem you had two years ago. Do you happen to remember where you put the source like the URL for the instance for incident and the instance for change request? something like www.change.servicenow.com and www.incident.servicenow.com. To let the system know which instance's incident and change request to act on? It seems like your answer is missing a bit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2019 07:54 PM
Hi Collfit,
I know i am responding to this question after a long time and i apologize for it, but to answer the question, the links of the target instance was used in the outbound SOAP message and then i have called it in the script include.
Once again apologies for not responding earlier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2021 10:13 PM
Hi collfit,
I got the same requirement as you performed few years back, could you please help me with SOAP MESSAGE.
like how do u create SOAP MESSAGE and what are the steps you followed.
Thanks & Regards,
Aswartha Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2018 03:25 AM
Hi Dinesh,
Can you please specify where we need to do this modifications?
Is it on SoapAttachment script include?
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2019 07:51 PM
Hi Sri,
Apologies for my delayed response, nope, the code mentioned in the solution is the actual code that i have used to send the attachment from one instance to another. It was written in my custom script include.