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.

Import or fix script with an Excel file .

Nabs
Tera Contributor

Hello everyone,

I have the following requirement that I am unable to implement. I have been provided with an Excel file containing one column with contract sys_ids and another column with a field for hours worked on the contracts. Therefore, each row has a sys_id and a field for hours worked. I need to update my contract table with the sys_ids of the existing contracts, updating the new field with the corresponding values (I have 240 rows). The complexity lies in the fact that I do not have a field to map, only sys_ids.

 

 

Cchange.PNG

Thank yo
u in advance for your time. 

5 REPLIES 5

Hemanth M1
Giga Sage
Giga Sage

Hi @Nabs ,

 

There are couples of ways to do this 

1) Easy import: here is my article how to insert/update date through template https://www.servicenow.com/community/developer-articles/how-to-create-or-update-records-using-excel-... 

 

2)You can use GlideExcelParser to read data and use GlideRecord to update the record

https://docs.servicenow.com/bundle/washingtondc-api-reference/page/app-store/dev_portal/API_referenc... 

 

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Nabs
Tera Contributor

Hello
thanks Hemanth M1

The problem is that I do not have a field to map for the update. I only have the sys_ids of the contracts that I need to update with the values from the "hours" field for each contract.

Hi @Nabs ,

 

why don’t you create a filed “Hours Worked” and map. Any issues??

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

S Goutham
Tera Guru

Hi @Nabs :
May I know how are you able to pull the sys_ids of the existing contract? if it a another ServiceNow instance I would suggest going with an XML import rather than an Excel import as data import are easier.


Note: Excel import impact has implications if the sys_id is already reutilized.

If you still want to go with Excel import you have to Coalesce the sys_id and map it to the target sys_id field so it updates the existing contract present on the target table.

 

I hope this solves your issue
Mark this as Helpful / Accept the Solution if this clears your issue