+ Start a Discussion
andy_diandy_di 

Remove Master-Detail field

Hi all,

 

I have a custom object (Contract_Line__c) that has a Master-Detail field (back to Contract). I'm making some changes to my code and no longer want that relationship there - in fact, I want a lookup relationship in its place.

 

I have it working in the sandbox - I was able to change my code (and unit tests that use that field), then remove the master-detail field from my custom object.

 

However - I am not able to deploy the solution because the unit tests no longer populate the Contract__c field which is a master-detail field and therefore mandatory.

I also cannot delete the field in production because 27 apex classes reference it.

I can't change the apex classes because I am unable to deploy the classes (see above).

 

I'm out of options - all I want to do is delete one field from a custom object!!!

 

Please help - I'm tearing my hair out!

 

Andy

 

 

andy_diandy_di

Oops! Just discovered that if I put the object back to 'In Development' I can change it back to a lookup field. My hair is safe for another day!

MrBrianMrBrian
This was driving me crazy, I was in the force.com ide pulling my hair out trying to update fields and schema relationships and classes. Your solution to simply move the object to "In Development" worked like a charm!