I need to fetch a contact name based on whether a field in account is true and picklist field in contact is 'update' for a case.

I am writing a query that will fetch the data from account, contact and case. Below is the query I've written so far:

SELECT Id, AccountId, Account.Name, owner.name, CaseNumber FROM Case 
where Account.checkbox = true and contact.status = 'update'
  • 2
    Above query will work just include contact.Name in the SOQL to fetch Contact Name
    – RCS
    Apr 12, 2017 at 11:46

1 Answer 1


Assuming you have Checkbox field in Account as IsChecked__c and Picklist field on Contact as Status__c.

An example query to fetch cases where Account's IsChecked field is check and Contact's Status field is Started:

SELECT Id, CaseNumber, Contact.Name FROM Case WHERE
    Account.IsChecked__c = true AND
    Contact.Status__c = 'Started'

Add Contact.Name in the fields you are retrieving so that you can use that in your code.

You must log in to answer this question.

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