Jared McKenzie
07/21/2021, 5:42 PMPhillip
07/22/2021, 2:33 AMJared McKenzie
07/22/2021, 2:34 AMPhillip
07/22/2021, 2:34 AMdynamicl
07/23/2021, 10:24 AMMichael B.
08/06/2021, 1:18 AMdynamicl
08/06/2021, 10:13 AMrequire(['N/record','N/https'],
function(record,https){
function _log(first,second){
log.debug(first,second);
}
var jsonData = {channel: "#general",
username: "test",
text: "Message from NetSuite to #general"};
var bodyData = JSON.stringify(jsonData);
var headerData = [];
headerData['Content-Type'] = 'application/x-www-form-urlencoded';
var targetURL = '<https://hooks.slack.com/services/[id1]/[id2]/[id3]>';
try{
var response = <http://https.post|https.post>({
url:targetURL,
headers:headerData,
body:bodyData
});
_log('response from slack',response.body);
}catch(e){
_log('ERROR',JSON.stringify(e));
}
});
You could call a generic version of this function from a user event, workflow etc with the data you want to send. Hope that helps :)