function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saju NathSaju Nath 

Changing the Datatype of the Custom Field

Hi Can anyone can help me on the below issue,

I am trying to change one of the text field to date, i am getting the following error. 
Error is:
The first validation error encountered was "Cannot change field type of a custom field referenced in Apex class or trigger: <a href="/01pZ0000000HWpU">CreateAccountWithContact</a>". 

Is it Possible to change the custom field datatype. 
If not can i move the data from one feild to another field. Please provide the sample query.

Thanks,
ManojjenaManojjena
Hi Saju,
This is because of you have refered in apex class .You need to comment that code where ever it is used then you can change the data type .
Also if any data is there in that field you need to take back up else data wil loss for that field .

Let me know if it helps !!
Thanks
Manoj
 
Amit Chaudhary 8Amit Chaudhary 8
This is because same field is being used in some code. Please check below post . I hope that will help you
https://help.salesforce.com/apex/HTViewHelpDoc?id=notes_on_changing_custom_field_types.htm&language=en (https://help.salesforce.com/apex/HTViewHelpDoc?id=notes_on_changing_custom_field_types.htm&language=en)

Please let us know if this will help you

Thanks
Amit Chaudhary