Scripted REST API POST method not inserting record into core_company table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 02:33 AM
Hi,
I have created a scripted REST API POST method to insert a record into "core_company" table from third party. When I am testing in POSTMAN and Explore REST API It is showing status message as "200". But the record is not inserting into core_company table. How can I fix thie issue?
I am attaching the script I have used, may be this is causing the issue. Can anyone suggest how can I modify below script to insert the record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 02:38 AM
Hi,
Can you please share your script? It is not possible to read data from image and rewrite code.
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 02:40 AM
Also can you please share how you are sending data from POSTMAN? What is payload included?
Also share what you configured in ServiceNow.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 05:22 AM
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var sysID = request.pathParams.sysid;
var gr = new GlideRecord('core_company');
gr.addQuery('sys_id',sysID);
gr.query();
if(gr.next()){
var body = {};
body.name = gr.name;
body.website = gr.website;
body.notes = gr.notes;
body.status = gr.status;
body.business_owners = gr.business_owners;
response.setBody(body);
}
})(request, response);
this is the script in resource
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 05:25 AM