Is it possible to change the Data Type on a custom field after creation?

Document ID : KB000045565
Last Modified Date : 14/02/2018
Show Technical Document Details

Question: 

After creating a custom field using WSP Schema Designer, is it possible to change the Data Type on that field?

For example, a field was created as an INTEGER at creation, but needs to be changeed to a STRING to be able to use the filed as needed for its purpose.

Environment: 

CA Service Desk Manager (All Versions)

Answer: 

Yes, this can be done, however it cannot be done using Web Screen Painter Schema Designer, but rather must be done by using manual steps.

 

***WARNING*** Before performing the following steps, take a backup of the database and any files that will be changed by the steps (you may want to backup the entire NX_ROOT directory for safe keeping).

 

Here are the steps using the example of changing a field from an INTEGER to a STRING (allowing 255 characters):

1. Stop CA Service Desk services

2. Update the custom field in wsp.mods file change the custom field from INTEGER to STRING

3. Update wsp_schema.sch file, change the custom field from INTEGER to STRING

4. Update the ddict.sch file, change the custom field from INTEGER to STRING 

5. Using SQL Server Management studio, update the entry in the dbo.wspcol for the custom field and change the type column in that row to the value "2".  

6. Using SQL Server Management studio, run the following query to update the datatype for the appropriate column:

 

alter table {table_name} 
alter column {column_name} {new_data_type}

 

For example:  If you wanted to update a field called z_county in the ca_location table to a string field instead of an integer field, you would use the following:

 

alter table ca_location 
alter column z_county nvarchar(200)

 

7. Start CA Service Desk Manager services back up

 

You should now be able to use your custom field as a string field.