+ Start a Discussion
scott1025971251scott1025971251 

Custom Object Relationship Name Doesn't Update

I am new to developing for Salesforce but I am almost positive this is a bug in their software.

 

I am trying to do a SOQL query through a parent-to-child relationship.  I have a cusom object called "Advisory Board History" with an API Name of "Advisory_Board_History__c" that is a child to a normal Contact.  Simple enough, here's my query:

 

"SELECT Name,
(
SELECT CreatedBy.Name
FROM Advisory_Board_History__r
)
FROM Contact"

 

But, it doesn't work!  It took me a while to arrive at this query too, I thought that using the "__r" instead of the normal "__c" to access the custom object through the API was smart, but alas...

 

I poked around but couldn't figure out how to fix it.  I wasn't sure if something with my syntax is wrong (again, I'm new to this), but then I went through my WSDL file (enterprise) and looked up the elements under Contact.  I found this as one of the elements:

 

<element name="Advisory_Board_Meetings__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>

 

Wait!  "Advisory_Board_Meetings__r" isn't equal to "Advisory_Board_History__r", that must be the problem!  If I substitute the "Advisory_Board_Meetings__r" API name, then the query works perfectly.  

 

BUT, I am 100% completely sure that the custom object I created is called "Advisory_Board_History__c".  It *used* to be called "Advisory_Board_Meetings__c", but then I changed it.  That change happened over 3 weeks ago, so I can't imagine that it hasn't propagated or something.

 

 

I tried changing the API name of the custom object and saving it.  The API name updates in SF and elsewhere in the WSDL (where it's called "Advisory_Board_History__c"), but NOT as a child elemet of the Contact complexType.  For example, if I change the API name to "Advisory_Board_Historyz", then it is correctly updated on SF.com and I get the following lines in my WSDL:

 

this: <complexType name="Advisory_Board_Historyz__c">...

BUT STILL: <element name="Advisory_Board_Meetings__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>

 

 

I also tried removing the "Advisory Board Historyz" custom object from my Contact page layout, saving, re-adding it, saving, and then regenerating my WSDL.  Same outcome.  

 

Unless this is some really bad feature in SF, I believe this is a bug.  Put concisely, when you update the API name of a custom object, the custom object API path name (__c) is changed normally, but the custom *relationship* API path name (__r) is NOT.

 

Fortunately, I can live with this.  But if this is a bug then I want to see it fixed!  Thanks, please let me know if you have any questions.

InternalServerErrorInternalServerError

 

I am not 100 % sure I understood the issue but if I am not wrong you should be updating the Child Relationship Name not just the object name. You can change this on the field itself.