Your requirement is not very clear. But, here i would like to tell you that, You can get your realted object's API name through appending __r with the lookup field you have.
For example,
From Object1__c you have to query the Object2__c's field name 'Field1__c' then,
Object1__c.Object2__r.Field1__c
Hope so this helps you...!
Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.
I have a ui where i pass a relationship name of an object, i some how want to get the api name of that object whose relationship name i have passed....
Hi,
Your requirement is not very clear. But, here i would like to tell you that, You can get your realted object's API name through appending __r with the lookup field you have.
For example,
From Object1__c you have to query the Object2__c's field name 'Field1__c' then,
Object1__c.Object2__r.Field1__c
Hope so this helps you...!
Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.
I have a ui where i pass a relationship name of an object, i some how want to get the api name of that object whose relationship name i have passed....
You want api name of parent object of lookup/masterdetail field?
Use below function.
This function will return parent object api name.
for example if you call this function like below
clsGeneral.getParentObjectNameByReferenceFieldName('Contact', 'AccountId');
This function will return "Account".
You want same?