Created
June 20, 2016 03:24
-
-
Save bryanbarnard/8b80dd64366a902d11275cf42df69229 to your computer and use it in GitHub Desktop.
Using getResponseAttachmentSysid()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tablename = 'incident'; | |
var recordSysId = '3197671513d75200a54fb8b12244b0f6'; | |
var filename = 'new_image.jpeg'; | |
var request = new sn_ws.RESTMessageV2(); | |
request.setHttpMethod('get'); | |
request.setEndpoint('https://demonightlyus.service-now.com/api/now/attachment/2b6644b15f1021001c9b2572f2b47763/file'); | |
request.saveResponseBodyAsAttachment(tablename, recordSysId, filename); | |
request.setBasicAuth('admin', '{update_with_password'); | |
var response = request.execute(); | |
var httpResponseStatus = response.getStatusCode(); | |
var httpResponseContentType = response.getHeader('Content-Type'); | |
var newAttachmentSysId = response.getResponseAttachmentSysid(); | |
var parsed; | |
var httpResponseBody; | |
gs.debug("http response status_code: " + httpResponseStatus); | |
gs.debug("http response content-type: " + httpResponseContentType); | |
gs.debug(newAttachmentSysId); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment