Skip to content

Instantly share code, notes, and snippets.

@manjufy
Last active January 6, 2017 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manjufy/4a92a2be693a8fda7ca84b58b8fa7154 to your computer and use it in GitHub Desktop.
Save manjufy/4a92a2be693a8fda7ca84b58b8fa7154 to your computer and use it in GitHub Desktop.
Calling Salesforce Webservice from NetSuite UserEventScript 2.0 (POST / PUT)
function afterSubmit(scriptContext) {
// prepare headers
var headers = {
'Authorization': 'Bearer <your access token>',
'Content-Type': 'application/json',
'accept': '*/*'
};
// prepare body, since I'm Updating a record in Salesforce, I'm using Http Method PUT
var body = {
"field1": "value1",
"field2": "value2"
};
var response = https.put({
url: 'https://<instancename>.salesforce.com/services/apexrest/{Webservice Endpoint name}',
headers: headers,
body: JSON.stringify(body)
});
log.debug('Result', response.body);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment