Unable to process multiple request in Import set API

ChaithraSandeep
Tera Contributor

Hi,
Am trying to explore Import set API, have created Import set table and Transform map. Through postman am able to create/update single record using below API. u_email field is set as Coalesce.

Source : u_import_user

Target : sys_user

POST https://dev322281.service-now.com/api/now/import/{stagingTableName}

Request : {
"u_first_name": "Load",
"u_last_name": "Test",
"u_department": "Finance",
"u_email": "load.test@example.com"
}

 

But am not able to process multiple record in single request ,

POST https://dev322281.service-now.com/api/now/import/{stagingTableName}/insertMultiple

 Multiple Request :
{
"records": [
{
"u_first_name": "Load",
"u_last_name": "Test",
"u_department": "Finance",
"u_email": "load.test@example.com"
},
{
"u_first_name": "Demo",
"u_last_name": "Test",
"u_department": "Finance",
"u_email": "demo.test@example.com"
}
]
}

 

Error Message : Unable to resolve target record, coalesce values not present: u_email

 

Thanks

1 ACCEPTED SOLUTION

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi @ChaithraSandeep 

1. Did you create an entry in the table "sys_rest_insert_multiple", like below?
Source would be your source table "u_import_user"

SaurabhGupta_0-1751643628658.png

 

2. Did you create entry in the table "sys_rest_insert_multiple_column_mapping"?

SaurabhGupta_1-1751643781122.png

 


Thanks and Regards,

Saurabh Gupta

View solution in original post

3 REPLIES 3

Mohammad Danis3
Tera Expert

@ChaithraSandeep , Please share the script.
You need to loop over JSON and insert each record into a table. Please find the example script.

var data =  JSON.parse(body);

for(var i =0; i<data.length; i++){
var record = data[i];

var gr = new GlideRecord("TABLE");
gr.intialize();
gr.u_name = record.name;
gr.insert();
}


 If my response solves your query, please marked helpful by selecting Accept as Solution and Helpful. 

Thanks,
Mohammad Danish

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi @ChaithraSandeep 

1. Did you create an entry in the table "sys_rest_insert_multiple", like below?
Source would be your source table "u_import_user"

SaurabhGupta_0-1751643628658.png

 

2. Did you create entry in the table "sys_rest_insert_multiple_column_mapping"?

SaurabhGupta_1-1751643781122.png

 


Thanks and Regards,

Saurabh Gupta

Hi @Saurabh Gupta  ,

 

Thank you, after creating an entry in both the tables, multiple insert is working.

 

Regards,

Chaithra