0

I am using below query to get the records.But in the output I am getting Account Id and Conatct id. How can i get the Account Name , Contact Name instead of Id's?

currentRecord = [SELECT Id,Account__c,Contact__c,Country__c,Notes__c,Business__c FROM Sample_Literature_Request__c WHERE Id = :currentRecord.Id];

1 Answer 1

4

Hi In order to get account and contact name you have to specify that particular field as well in query. For eg in your query you have to add Account__r.name to get account name and Contact__r.name to get contact name. so finally your SOQL query will look like

currentRecord = [SELECT Id,Account__c,Account__r.name, Contact__c,Contact__r.name, Country__c,Notes__c,Business__c FROM Sample_Literature_Request__c WHERE Id = :currentRecord.Id];

For more reference please check out salesforce docs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .