You need to sign in to do that
Don't have an account?
Shahamir Sheikh
how to get object name of lookup field in apex
how to get object name of lookup field in apex
for ex:
I have obj customObj__c
In this obj have lookup field of Account name: customObj Account
Now I have obj Name : customObj__c and lookup field Name:customObj Account.
problem is that how to get releted object Name(Account) by lookup fieldApiName(customObj_Account__r) and object. name(customObj__c )
for ex:
I have obj customObj__c
In this obj have lookup field of Account name: customObj Account
Now I have obj Name : customObj__c and lookup field Name:customObj Account.
problem is that how to get releted object Name(Account) by lookup fieldApiName(customObj_Account__r) and object. name(customObj__c )
you can get it by using customObj_Account__r.Name
If this helps, Please mark it as best answer.
Thanks!!
Use the below apex code. The account record Id will be shown instead of the account name if you query the list of customObj records but if you want the account name to show up in debug log then iterate the list and call the fields using a variable. Call the method in the anonymous block:
If this is useful, please mark it as the best answer.
Thanks & Regards,
Shams Tabrez