I have custom object and custom object field which is a lookup to Account. I am able to retrieve account record value from the lookup field but I am getting only the id of the record . I need to get the name of the record.
for eg: The record name is 'Ac_record' and the ID is '123456609xya', I am only getting the id not the name of the Account record.
How can I achieve it?
my code:
obj = select id, name, Location__c from customObj__c where id in: setId;
srting location = obj.Location__c;
location__c
is lookup to Account, please help me solve this issue.
Attribution to: AnuRaj
Possible Suggestion/Solution #1
You can use
obj = select id, name, Location__r.name from customObj__c where id in: setId;
Attribution to: Prady
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1157