multiple Import set api response customization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 10:20 PM
Hi
I am using import set API to insert multiple incidents. But the response is returning import set ID.
Can someone advise how do i get the incident numbers as response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 10:52 PM
HI @anuannap123 ,
You can query like below.
var importSetId = 'ISET00001';
var result = [];
var gr = new GlideRecord('sys_import_set_row');
gr.addQuery('set', importSetId);
gr.query();
while (gr.next()) {
result.push(gr.sys_target_sys_id.number);
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 11:11 PM
thank you. But where do i query this code? do you mean to create one scripted rest api and in script to pass this?
Also this is passing static import set id. how do i get customize the response to return the incident number as soon as the multiple records inserted into incident table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 11:20 PM
Hi @anuannap123 ,
The place where you had made API call and as a response you are getting import set id.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2025 01:12 AM
Hi @anuannap123 ,
Let me know if still required more help.
If my answer addressed your query, feel free to accept it to help others in the community benefit as well.