How to fetch data to another table

Talari Balateja
Tera Expert

Hi Developers,

 

I stuck at data transfer to another table. 

Like I created one custom table for requirement. Now I want fetch total records to another table. In my custom table I dot walked all field to show data in table.

 

Custom table (sn_vul_vulnerability_top_25_item)

OOB data table (sn_vul_vulnerable_item)

 

Thanks in Advance,

Bala.

6 REPLIES 6

Tony Chatfield1
Kilo Patron

Hi, unfortunately your post\requirement is not clear, but it seems to indicate that you have created a table to store the top 25 records from another tables and wish to duplicate the records across to the '25' table?

If I have understood correctly then the use of a table specifically to store 25 records seems like a very inefficient use of SNC table licensing and I would not recommend it, similarly the duplication of x record from 1 table to another also has questionable value. Can you not just add an additional field to your primary table and populate with a value that identifies the '25'?

 

If I have misunderstood? the perhaps you could update this thread with clear and specific details of your configuration, process and requirements?

Hi Tony,

 

Yes I'm also trying to show Top 25 records in my report. Any additional suggestions to show top 25 records in my report.

Harish Bainsla
Kilo Patron
Kilo Patron

you can use below code here to copy the data from one table to another table

var gr = new GlideRecord('incident');
gr.query();
while(gr.next()){

var gr1 = new GlideRecord('u_custom');
gr1.initialize();
gr1.u_name= gr.short_description;
gr1.u_number = gr.number;
gr1.insert();

 

}

Hi Harish,

 

Do I need to run this script in background..??