This course is currently a work in progress. Please join the waitlist to receive regular updates.

OR Operator in SOQL

OR operator is used to filter records from a SOQL query results. The OR operator is used to find records that match any filter conditions.

Using OR clause in SOQL

Following is an example of using OR clause in SOQL to find the cases where origin is 'Email' or status is 'New'.

Loading...

In the above example:

  • The query statement starts with a SELECT keyword, followed by a set of comma-separated fields (e.g. id, caseNumber) that you want to query from an object.
  • The FROM keyword specifies the object (e.g., Case) from which data is queried in Salesforce.
  • The records are filtered using the WHERE condition, with filters applied to fields like Origin and Status.
  • The OR keyword is used to filter case records where the Origin is Email and the Status is New.

Try It Yourself

Loading...