Last active
January 6, 2017 04:26
-
-
Save manjufy/4a92a2be693a8fda7ca84b58b8fa7154 to your computer and use it in GitHub Desktop.
Calling Salesforce Webservice from NetSuite UserEventScript 2.0 (POST / PUT)
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
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