Trouble with submitproducer api with customer service application scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 07:49 AM
Hello,
I have a requirement to create a record producer when a record is inserted to a custom table.
I use the submitproducer API. All is working fine in the global application scope (the record producer is created with variables filled). But when i use a record producer that is in the customer service application scope, nothing is created.
here's the code :
(function executeRule(current, previous /*null when async*/) {
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://mydboxdev.service-now.com/api/sn_sc/servicecatalog/items/b919466b87928610ba0e4157cebb351d/su...');
request.setHttpMethod('POST');
var bat = current.getValue('u_batiment');
var site = current.getValue('u_site');
var etage = current.getValue('u_etage');
var contact = current.getValue('u_contact');
var num = current.getValue('u_numero');
var compte = 'b4886d411b3891103901eb91604bcb5e';
var body = {'variables':{"account":compte,"site":site,"batiment":bat,"contact":contact,"numero_du_contact":num,"etage":etage}};
request.setBasicAuth('login','password');
request.setRequestHeader("Accept","application/json");
request.setRequestHeader('Content-Type','application/json');
request.setRequestBody(JSON.stringify(body));
var response = request.execute();
})(current, previous);
Than You for your help.
Richard.