I'm facing a problem on changing data type of a field from TEXT to Picklist. To avoid any loss of data I took an export of data of the related records on the target org and have updated the field with the valid picklist values only. However when I'm deploying I'm getting this error:

 objects/[ObjectAPIName].object FieldAPIName.RecordTypeName) -- Error: Picklist value: [PicklistValue] in picklist: FieldAPIName not found 

I created a new picklist field and then it got deployed successfully but as this field is already present on higher orgs correct approach would be changing data type of the existing field.

Can someone point out how do i avoid this error?

Note: I've checked repeatedly the object file(xml) and it is perfect. The field is present with modified data type and picklist values and it is also present on the recordtypes as well.

  • Is this field referenced in Apex code of Target Org? – Devendra Oct 6 '16 at 12:24
  • Yeah. It is referenced on one of the class. – Sagnik Oct 6 '16 at 12:37
  • You cannot change the data type of a custom field if it is referenced in Apex. May be you can comment those references in apex code and try the deployment. After successful deployment, remove previously added comments from code. – Devendra Oct 6 '16 at 12:40
  • I thought so but the error is pointing something else. Will try with your approach. – Sagnik Oct 6 '16 at 12:50
  • Here is the link, help.salesforce.com/… which says "You cannot change the data type of a custom field if it is referenced in Apex." – Devendra Oct 6 '16 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.