Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Insert data into custom table

ujwalabedar
Mega Contributor

Hi all,

 

I want to insert data into custom table by fetching the data from software installation table  after applying some filter and software install table has millions of records in it. Can anyone suggest best way to do it?

2 REPLIES 2

Maniteja_2003
Tera Guru

Hi @ujwalabedar ,

 

I hope this answer helps you.

 

I have one question: Do you have a strong use case that requires creating a custom table? If you are trying to solve a specific problem by creating a custom table, please let me know the use case or the problem you are trying to address. We may be able to achieve the same requirement without creating a custom table.

 

Thanks,

Maniteja.

Tejas Adhalrao
Kilo Sage

hi @ujwalabedar  ,

 

Since the Software Installation table has millions of records, I would avoid querying everything and then looping through it.

Use a Scheduled Script/Background Script with a well-indexed filter, fetch only the required fields, and process the records in batches. Also check whether the fields used in your filter are indexed; indexing will make a big difference at this volume.

If this is a recurring requirement, consider using a scheduled job that processes only new/updated records instead of rebuilding the entire custom table every time. Also handle duplicates using a unique key/coalesce check before inserting.

If this helps, please mark it as Helpful and accept the solution.
Regards,
Tejas