Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Convert String field to Reference field of a Custom Table

brogaming70
Giga Contributor

I want to convert the String type field into reference type, but getting this error. As, there are already 2000 records in the table. How can I do this?

3 REPLIES 3

abbasshaik4
Tera Sage

Hello @brogaming70,

 

Please refer to the links below:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0695947
https://www.servicenow.com/community/developer-forum/changing-the-type-of-field-from-string-to-refer...

 

If it is helpful, please mark it as helpful and accept the correct solution. By referring to this solution in the future, it will be helpful to them.

 

Thanks & Regards,

Abbas Shaik

Ankur Bawiskar
Tera Patron

@brogaming70 

string contains text. how will you replace it with reference type as it requires a custom table

The error message clearly says you have data in that field for records and hence you can't convert

check this

Changing or converting field type 'string' to 'reference' on existing, custom field 

Workaround

-> export that table data including that field

-> then delete the data from that field

-> then change the type

-> then create a custom table which holds that string values which you exported earlier

-> load data to your existing table for that field and update the field with that record sysId holding the string in custom table

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@brogaming70 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader