Copy the response body of the import set api to new table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2024 05:52 AM
Hi , Could you please tell how can i copy the response body (which we will get when we hit the import set api) to another table .
ex: { "import_set": "ISET29325654",
"staging_table": "ABC",
"result": [
{ "transform_map": "ABC Transform Map",
"table": "sc_task",
"display_name": "number",
"display_value": "SCTASK0815512",
"record_link": "https://ABC/api/now/table/sc_task/93a4a9999bc6c610f41811b5bb4bcbb0",
"status": "error",
"sys_id": "93a4a9999bc6c610f41811b5bb4bcbb0",
"status_message": "Ignored: System could not find the Catalog Task: SCTASK0815512 in ServiceNow", "error_message": "This catalog task may not belong to catalog item. Please provide a valid catalog task" }
]
}
This is the response (and this response is different each time AND depends upon the sctask number ) .. now i want this response to be saved in another table's particular field .. Kindly please help me !!! Thank you ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2024 06:13 AM
try the below code to save reponse .
var grTicket = new GlideRecord('table name');
grTicket.initialize();
grTicket.setValue('tablefileld name', responsbody);
grTicket.insert();
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2024 06:50 AM - edited ‎05-15-2024 06:50 AM
Hi @dgarad could you please suggest how i will get the responsebody field that you have used in setValue in the code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2024 07:05 AM
where you hit the import set API.
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2024 07:09 AM - edited ‎05-15-2024 09:49 AM
Hi @dgarad from postman i am hitting an import set api for a staging table called ABC that will map with sctask table
POST https://demo.service-now.com/api/now/import/ABC
with sctask number as mandatory and valid sctask number