Blue choice field values - updating missing values

jcmings
Mega Sage

I've been asked to update a choice list. All of the old values of the choice list will be replaced by new ones, but we are being provided a mapping of which old values will map to which news ones.

 

If I delete the old values from the choice list, they will appear as Blue (since they are missing). Is this "missing" value stored somewhere? Would I be able to do a fix script to say (if choice is "abc", update to "xyz")?

 

Or should I instead create the new values, run a fix script to map old values to new values, and then run a fix script to delete the old values from the table? I basically need to know if the missing value is still stored or not.

 

1 ACCEPTED SOLUTION

Manmohan K
Tera Sage

@jcmings 

 

The missing values are not stored anywhere in servicenow

You should create the new choices first and run a fix script to map old choice values to new choice values

Verify that all records have new choice values by using group by in list view on the field containing the choices

Later you can mark the old choices as inactive true or delete them (make sure that the choices are not used in other tables before taking this action)

 

View solution in original post

3 REPLIES 3

John Dewhurst
Kilo Guru

A choice field contains the value of the sys_choice record, this persists even if the sys_choice record no longer exists, and as you say shows blue to indicate it has a value that does not exist in the choice list for this field/element.

In a lot of operations it would not throw an issue to have these set as values that no longer exists, however if you want to use something like GlideQuery, it will throw an error if you try to set to a value that is not in the choice list. My choices would be either...

- Replace the choice list with the new values, map the new values onto the records
- or add the values leaving the original there until you've mapped the values then remove the originals.

Generally either of these are fine

Manmohan K
Tera Sage

@jcmings 

 

The missing values are not stored anywhere in servicenow

You should create the new choices first and run a fix script to map old choice values to new choice values

Verify that all records have new choice values by using group by in list view on the field containing the choices

Later you can mark the old choices as inactive true or delete them (make sure that the choices are not used in other tables before taking this action)

 

Thanks, I ended up going this route. I created the new choices, used a fix script to map the old choices to the new ones, and then another fix script deactivates all the old choices.