function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mayur MogheMayur Moghe 

How to get account status via contact from case , I want Account status (field in account object ) Case >contact>account>account status using soql query

How to get account status via contact from case , I want Account status (field in account object ) Case >contact>account>account status using soql query
Dosbol TDosbol T
Hi There, please try this one:
 
SELECT Account.AccountStatus, Account.Name, Contact.Name, Case.Subject FROM Case WHERE Id = :caseId

 
Dosbol TDosbol T
OR, if you need Account status for the Account associated with a Case's Contact using SOQL, you can use:
 
SELECT Account.AccountStatus FROM Case WHERE Id = :caseId

 
AnkaiahAnkaiah (Salesforce Developers) 
Hi Mayur,

try with below query.
select id, Contact.Account.Status__c from case where contactid !=Null

If this helps, Please mark it as best answer.

Thanks!!