Insert json to import set table from flow designer rest call

ShAn21
Tera Guru

Hi Team,

I have a requirement where I have setup a REST integration from Flow Designer.

The response is a complex json object. I want to transform this data to ServiceNow table via transform map.

What is the best way to get this data to the import set table? Will direct Glide Record Insert work?

or is there any configurable options provided within Servicenow.

Any feedback is appreciated.

 

Thanks

1 REPLY 1

Harshal Aditya
Mega Sage
Mega Sage

Hi @ShAn21 ,

 

Hope you doing good.

 

After you receive the response you can trigger a import set API integration to your instance. It will automatically insert into your staging table and will run your transform map. 

 

Here is a sample script you can configure the same in flow actions.

 

//Create a JSON object to insert into your staging table for simplicity I have taken only one fields
var incJson = {
	"u_short_description":"test"      
};
var res = JSON.stringify(incJson);

try { 
 var r = new sn_ws.RESTMessageV2('test import set API', 'create incident'); // Repleace with your rest message name
 request.setRequestBody(res);
 var response = r.execute();
 var responseBody = response.getBody();
 var httpStatus = response.getStatusCode();
 gs.log(responseBody);
}
catch(ex) {
 var message = ex.message;
}

 

Below is the rest message replace the rest end point with your staging name.

 

HarshalAditya_1-1677832027607.png

 

 

Please Mark My Response as Correct/Helpful based on Impact

Regards,
Harshal