The CreatorCon Call for Content is officially open! Get started here.

How to import one table data to another table

Elin25
Kilo Expert

How to import core_company table data which is in global application into customer_account data which is in customer service application 

2 ACCEPTED SOLUTIONS

Gunjan Kiratkar
Kilo Patron
Kilo Patron

hi @Elin25 ,

I have two ways :-

1) Goto core_company table and from list view change the class of company as 'Account' and Customer as 'true'.

Record will automatically create in account table.

GunjanKiratkar_0-1668148765911.png

 

2) Export Data from core company table in excel formate and then import the data into customer_account table using transform map.


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

Thanks for quick response

 

The first way is really great option we have to do for more than 90000 records so it is bit of complexity 

 

And 2nd way Here we don't want to export data from instance so please suggest any alternate way thank you 

 

View solution in original post

7 REPLIES 7

Hi @Elin25 ,

 

You can goto the fixed script from application navigator and then writedown script as below :-

Then click on run script- Before that apply your own encoded query for which you wanted to update the data. Copy query from list view filter. First try to update only 2-3 records for testing.

 

var gr=new GlideRecord('core_company'); 
gr.addEncodedQuery("city=Shanghai"); //Apply query as per your requirement
gr.query(); 
while(gr.next()){ 
gr.sys_class_name='customer_account'; 
gr.customer='true'; 
gr.update(); 
}

GunjanKiratkar_0-1668152026610.png

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Thank you so much appreciated

 

We have so many records if possible can we update records in batch wise if yes how can we do using script and it shouldn't create duplicate please suggest

 

Thank you 

Hello gunjan 

 

I tried above changing class name but records(data) is not showing for different module  

 

I mean record is not showing in core_company table and it is visible for customer_account table