Find your content:

Search form

You are here

Can you convert a Master-Detail relationship to a Lookup if it's referenced in code?

 
Share

I've got a Master-Detail relationship on a custom object where the parent is the Account object. There are no roll-up summary fields on the Account object, and there are no formula fields on the custom object referencing the relationship.

For some reason I still don't see the option to change the field back to a look-up relationship — there's nothing in the documentation to suggest that I need to do anything with the data (unlike having null values when going the other way) so I'm wondering whether any code references to the field will stop the button from appearing or not.

I could dump the data in the field using DataLoader and try to delete it to find out, but I'm wondering if anybody knows what controls the Change Type buttons visibility?


Attribution to: Matt Lacey

Possible Suggestion/Solution #1

The field which you want to convert master detail to lookup is used in some rollup summary. First, you have to delete those fields, then automatically change field type button is enabled.


Attribution to: Kishor Vitekar

Possible Suggestion/Solution #2

Converting Relationships

  1. You can convert a master-detail relationship to a lookup relationship as long as no roll-up summary fields exist on the master object. Please see the LINK for all details 

  2. You can convert a lookup relationship to a master-detail relationship, but only if the lookup field in all records contains a value.

https://help.salesforce.com/articleView?id=relationships_considerations.htm&type=0


Attribution to: Amogh

Possible Suggestion/Solution #3

Turns out I'd overlooked something: there was a deleted roll-up summary still in the deleted fields section of the Account object.

Deleting that allowed me to change the field's type without modifying code and without deleting the field or losing data.


Attribution to: Matt Lacey
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/907

My Block Status

My Block Content