You need to sign in to do that
Don't have an account?
Jason Kuzmak 12
Unable to query child object records by recently changed name
Hi all,
I'm having a problem related child objects using SOQL. In preparation for another object that has yet to be created, I made corrections to my custom object name, though now I can only query related child records using the old (wrong) name. My code here shows that now, the system recognizes both:
This saves successfully, and I have no idea why. There is no longer such an object as "Checklist_Item_Junction__c", but it's requiring that I call it that in my child relationship query.
I'm having a problem related child objects using SOQL. In preparation for another object that has yet to be created, I made corrections to my custom object name, though now I can only query related child records using the old (wrong) name. My code here shows that now, the system recognizes both:
// Query child "Checklist_Item_Junctions__r" even though that is no longer the object's name List<Checklist_Template__c> templateQuery = [Select Id, Machine_Series__c, (Select Id, Checklist_Template__c, Checklist_Template_Item__c From Checklist_Item_Junctions__r) From Checklist_Template__c]; // separately query all "Checklist_Template_Item_Junction__c" records, (the new name of the object) List<Checklist_Template_Item_Junction__c> junctionQuery = [Select Id, Checklist_Template__c, Checklist_Template_Item__c From Checklist_Template_Item_Junction__c];
This saves successfully, and I have no idea why. There is no longer such an object as "Checklist_Item_Junction__c", but it's requiring that I call it that in my child relationship query.
Try going to the lookup field of custom object and check whether the name of child relationship is correct or not . Rename it with name that you want to use.
Hope this helps :)
All Answers
and that there is not also an object called "Checklist Item Junction" in my list of objects anymore:
Nothing happened. It still accepts the old incorrect object name.
Try going to the lookup field of custom object and check whether the name of child relationship is correct or not . Rename it with name that you want to use.
Hope this helps :)
Fyi , when you edit and save the relationship name it may give reference error as your code might be using the old child relationship name , so code commenting will be needed for this.
@Dushyant Sonwar
I think that did it! Thanks very much!