0

How to read all checkbox=true fields from sObject in soql query? Here is my query:

List<Sample__c> lst = [
    SELECT summary__c,status__c,priority__c,issuetype__c,updated__c
    FROM Sample__c WHERE ...
];

What should I pass in my WHERE condition for getting all check box fields true?

1 Answer 1

0

You would do it like any other where filter

where chackbox1__c = true AND checkbox2__c = true AND checkbox3__c = true AND .....

Since your query is not dynamic (a query string and then database.query) this would be your option.

In order to be more dynamic you would have to construct your query string using the describe methods to get the checkbox field names and add them to the filter part of your query.

If this is what you would like to do please update your question

1
  • i have different checkbox fields in Sample__c object so i need to query all checkbox fields are true so is there anyway to read fields instead of each field mentioning as like this here chackbox1__c = true AND checkbox2__c = true AND checkbox3__c = true AND .....
    – siva
    Apr 24, 2017 at 16:34

You must log in to answer this question.

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