- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 07:12 PM
Hello All,
Unable to delete record in 3rd party tool with HTTP delete method. Getting below mentioned error.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
try {
var r = new sn_ws.RESTMessageV2('Machine Users', 'Delete Machineuser');
var body = {
"id": 118206,
"clientId": 1510,
};
r.setRequestHeader('Content-Type', 'application/json');
r.setRequestBody(JSON.stringify(body));
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.addInfoMessage('response status:' + httpStatus );
gs.addInfoMessage(JSON.stringify(responseBody));
}
catch(ex) {
var message = ex.message;
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 06:30 AM
Thanks all for the help,
I have modified the end point URL in the rest message and in script I added the parameters.
Now it's working fine. Below are the changes.
script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 01:08 AM
Did you try hitting their endpoint from Postman with DELETE and content body?
If it works from postman then you can determine/debug why it's not working from ServiceNow.
How does their body look like?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 01:55 AM - edited 11-07-2023 01:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 02:14 AM
but you are sending content body so that is not required. this is what I mentioned.
you need to pass those in url parameters
form the URL and include variable substitutions
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 02:28 AM
Ok, can you help me with the url and script please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 02:42 AM
please start from your side
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader