Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

multiple Import set api response customization

anuannap123
Tera Contributor

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

4 REPLIES 4

Runjay Patel
Giga Sage

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

-------------------------------------------------------------------------

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 

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

-------------------------------------------------------------------------

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.