Say I have a master-detail relationship between two objects, Schematic__c
and Part__c
.
I can SOQL query the master from the detail: [SELECT Schematic__r.Name FROM Part__c]
If I'm building a query from strings, I resolve the schema name, for example in a managed package:
SObjectType.Part__c.Fields.Schematic__c.Name //gives me 'ns__Schematic__c'
But when traversing into the master object, the __r
relationship suffix is what I need to surface. I've toyed around with the obvious Schema.SObjectType variations but I'm not having much luck:
SObjectType.Part__c.Fields.Schematic__r.Name //Schematic__r is not a field of ns__Symbol__c
What's the correct way to resolve the ns__Schematic__r.Name
token without replacing the suffix?
Part__c
object and create a new Field Set, 2. dragPart Name
andSchematic Name
into the Field Set, 3. execSObjectType.Part__c.FieldSets.MyFieldSetName.fields[1].FieldPath
which givesns__Schematic__r.Name
, but Field Sets are subject to removal and rearrangement etc. – bigassforce Jan 5 '14 at 1:08