change field type

G Balaji
Kilo Guru

Hi,

We've a custom application running in prod. We've a requirement to change the field type from choice to List. How do I implement without data loss for existing line records? This will be a one-time execution to copy existing data to new fields.

For now, my implementation plan is to create another field of type list and copy choice field(dropdown) values to list(reference) fields using background scripts(pretty easy to implement but can't keep track of the changes in activity logs and also performance might take a hit) or to create UI page(performance will not take a hit but comparatively difficult to implement).

Is there any better/feasible ways to implement this without using background scripts or UI page?

Thanks.

1 ACCEPTED SOLUTION

DO not run in background script.

You should run FIX SCRIPT where you choose option to run in background and then you will have no issue of data loss.

 

https://docs.servicenow.com/bundle/madrid-application-development/page/build/applications/concept/c_FixScripts.html

 

Regards,

Sachin

View solution in original post

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

You should create new field with List data type and then run fix script to copy data from choice list to list field.

Run your fix script in background so that performance is not hit and you can monitor using progress worker.

This way you don't loose any date in existing choice list type in PROD instance.

You will have make sure that all your objects ( like business rules, client scripts , script includes) are updated to accept this new data type change so that your functionality is not implemented.

 

Also, make sure that you do this first in DEV instance and then move to production.

 

Regards,

Sachin

Thanks for the response, Sachin.

But isn't there a risk of data loss while using Background scripts(Running freeform script can cause system disruption or loss of data.)?

 

DO not run in background script.

You should run FIX SCRIPT where you choose option to run in background and then you will have no issue of data loss.

 

https://docs.servicenow.com/bundle/madrid-application-development/page/build/applications/concept/c_FixScripts.html

 

Regards,

Sachin

G Balaji
Kilo Guru

Thanks for the response, Sachin.

What is the purpose of "Flush Cache"? What would be the impact of it?

And, there are two field values

1. Run once

2. Flush cache

which is enforced or not for the test fix scripts.

Could you please explain how the tool recognize it's a test run. How is the same configured?