How to convert Reference field to Single Line text field ?

RAM75
Tera Contributor

How to convert Reference field to Single Line text field ? 

Please provide any examples..

Thanks 

Ram

1 ACCEPTED SOLUTION

Dan H
Tera Guru

Hi,

Hopefully you only need to do this for fields that you have created as changing a OOTB reference field to a string can cause huge problems. As that field could be being used in other scripts/business rules/flows/etc

In any case, one way to do it is the following:

 

Right click on field name "task"

find_real_file.png

 

Select configure dictionary

find_real_file.png

 

Change type from Reference to String

 

find_real_file.png

 

Result:

find_real_file.png

 

If this field is brand new and hasnt been populated before in any records then this is an okay solution.

If this field is populated already in the system by some records, you must be careful as you could lose data that was stored in this field as a reference.

In that case, you should create a duplicate field with the string type and run a  background/fix script to copy the reference's display value (.getDisplayValue) into the text field

But as per your customers question - "Is this possible?", answer is yes

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

why to convert?

what's the business requirement?

Regards
Ankur

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

Thanks for your response , Client didn't tell any  business requirement, 

in the meetings client was requested  , is it possible in ServiceNow?

 

Thanks

yes you can convert the type but remember it would lead to data loss if the field already holds some value in it

Be careful on that part.

OR

better create new reference field and deactivate the string one

Regards
Ankur

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

Dan H
Tera Guru

Hi,

Hopefully you only need to do this for fields that you have created as changing a OOTB reference field to a string can cause huge problems. As that field could be being used in other scripts/business rules/flows/etc

In any case, one way to do it is the following:

 

Right click on field name "task"

find_real_file.png

 

Select configure dictionary

find_real_file.png

 

Change type from Reference to String

 

find_real_file.png

 

Result:

find_real_file.png

 

If this field is brand new and hasnt been populated before in any records then this is an okay solution.

If this field is populated already in the system by some records, you must be careful as you could lose data that was stored in this field as a reference.

In that case, you should create a duplicate field with the string type and run a  background/fix script to copy the reference's display value (.getDisplayValue) into the text field

But as per your customers question - "Is this possible?", answer is yes