Skip to content

Instantly share code, notes, and snippets.

@rustamtm
rustamtm / servicenow_restmessagev2_response_as_attachment.js
Created November 7, 2019 23:27 — forked from jnerius/servicenow_restmessagev2_response_as_attachment.js
Saving a RESTMessageV2 response as an attachment and getting the attachment's sys_id #ServiceNowSnippet
// This is where we'll save the attachment
var tablename = 'incident';
var recordSysId = '8d6353eac0a8016400d8a125ca14fc1f';
var filename = 'snlogo.png';
// Let's download the ServiceNow Logo
var logoUrl = 'https://instance.service-now.com/images/logos/logo_service-now.png';
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('get');
request.setEndpoint(logoUrl);