Skip to content
No results
  • Home
  • Services
  • Contact Us
  • Portfolio
    • websites
  • Blog
    • Content Marketing
    • Salesforce
  • Learning
    • Code
  • Resources
abm
  • Home
  • Services
  • Contact Us
  • Portfolio
    • websites
  • Blog
    • Content Marketing
    • Salesforce
  • Learning
    • Code
  • Resources
abm

Salesforce SOQL LIKE

  • Blog, Salesforce

In Salesforce SOQL (Salesforce Object Query Language), to combine a LIKE statement with an IN statement, you usually have to split them into separate parts of the query because IN is typically used for exact matches while LIKE is used for pattern matching. However, you can creatively use them together to achieve complex querying.

Let’s assume you want to query the Account object for records where the Name field matches a pattern (using LIKE) and the Industry field is one of several specific values (using IN). Here’s how you could structure such a query:

SELECT Id, Name, Industry FROM Account WHERE (Name LIKE '%Pattern%') AND (Industry IN('Banking', 'Technology', 'Healthcare'))

In this query:

  • %Pattern%: Represents a pattern you’re searching for within the Name field. % is a wildcard that matches zero or more characters, so this would match any Name that includes “Pattern” anywhere in it.
  • IN ('Banking', 'Technology', 'Healthcare'): Specifies that you want to match records where the Industry field is either “Banking”, “Technology”, or “Healthcare”.

This SOQL query will return all accounts where the name contains “Pattern” and the industry is either Banking, Technology, or Healthcare.

Remember, SOQL is designed to work within the Salesforce environment, so make sure to execute this query in a context where you have permissions to access these records and fields.

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • More
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket

Like this:

Like Loading...
Tags
# account-object# salesforce-soql# SOQL# soql-in# soql-like# soql-where-clause
  • Home
  • Services
  • Contact Us
  • Portfolio
    • websites
  • Blog
    • Content Marketing
    • Salesforce
  • Learning
    • Code
  • Resources

Recent Posts

  • Understanding the Loop: A Simple Explanation of (let i = 0; i < 5; i++)
  • Why You Should Stop Using var in JavaScript and Switch to let and const
  • How to Find Objects with ‘History’ in Their Name in Salesforce
  • A Short Story of Apex Unit testing
  • 5 Must Know Salesforce SOQL Queries for Everyday Use

WELCOME TO ABM

We bring ideas to life through thoughtful, creative design solutions.

...

Our Work ▾

Copyright © 2025 - WordPress Theme by ABM

%d