- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 10:48 AM
On a integration from one SN instance to another I am sending new attachments on insert to the other instances incident. Using a business rule. It is almost like the rest api is looking for the sys_id of the attachment on the target table instead of the source table.
I am using the following code to send the attachment:
var attachmentMessage = new sn_ws.RESTMessageV2();
attachmentMessage.setHttpMethod("post");
attachmentMessage.setEndpoint( "https://xxxxxxdev.service-now.com/api/now/attachment/file");
attachmentMessage.setAuthenticationProfile("basic","de9867e9dbe0ff801acd4672399619d4");
attachmentMessage.setQueryParameter("table_name", current.table_name);
attachmentMessage.setQueryParameter("table_sys_id", ism_sysid);
attachmentMessage.setQueryParameter("file_name", current.file_name);
attachmentMessage.setRequestHeader("Content-Type", current.content_type);
attachmentMessage.setRequestHeader("Accept", "application/json");
attachmentMessage.setRequestBodyFromAttachment(current.sys_id);
var response = attachmentMessage.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.log('attachment to be sent to ISM'+response.getBody());
I get the following error in my log:
com.glide.communications.ProcessingException: Error executing REST request: attachment does not exist with sys_id: 8b320176db3cfb001acd4672399619c9
Caused by error in sys_script.99df9784db34b3001acd4672399619ab.script at line 49
I checked the sys_id in the error and it opens the attachment on the source instance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 09:36 AM
Sorry, I think this was resolved a couple of years ago. The sys_id was from the wrong side of the integration. I found the correct sys_id and then the attachment was found.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 11:19 AM
Just a sanity check, where is your ism_sysid variable being defined?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 12:24 PM
I am doing a get above in the business rule. I have printed that and did a search on the target side to make sure it is valid.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 09:21 AM
Try setting the when field on your business rule to after.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 09:36 AM
Sorry, I think this was resolved a couple of years ago. The sys_id was from the wrong side of the integration. I found the correct sys_id and then the attachment was found.