Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 11:30 AM
Hello @swathisarang98 and @Sohail Khilji ,
Below is my sample script and its output. In the screen shot we can see that two Software value came.
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
try {
var requestBody = request.body.data;
var caller = requestBody.caller;
var category = requestBody.category;
var shortdescription = requestBody.shortdescription;
// Insert record into UserTable
var gr = new GlideRecord('incident');
gr.initialize();
gr.setValue('caller_id', caller);
gr.setValue('category', category);
gr.setValue('short_description', shortdescription);
gr.insert();
response.setStatus(201); // 201 Created
response.setBody({
message: "Records created successfully in incident table"
});
} catch (ex) {
response.setStatus(500); // 500 Internal Server Error
response.setBody({
error: "An error occurred while processing the request"
});
}
})(request, response);