logo
MENUMENU
  • Services
        • Salesforce

        • Salesforce OverviewWe help our clients to make the most out of their technology investments.
          • Salesforce Overview
          • Systems Integration
          • Managed Services
          • Field Service Lightning
          • Salesforce CPQ
        • Verint

        • Verint OverviewOur services cover Implementations, Upgrades, Migrations, Reporting Solutions & Application Support.
          • Verint Overview
          • Verint Knowledge Management
          • Verint KM Integrations
          • Verint Omni-Channel
          • Verint Unified Desktop & Case Management
          • Verint Workforce Optimization
          • Verint Intelligent Virtual Assistant
          • Verint Robotic Process Automation
        • Artificial Intelligence

        • Artificial Intelligence
          • AI Overview
          • Data Engineering
          • Analytics/BI
          • Predictive Analytics
          • Computer Vision
          • Natural Language Processing (NLP)
          • ML Ops
        • Cloud & Mobile Apps

        • Cloud & Mobile App Development OverviewOur services cover Implementations, Upgrades, Migrations, Reporting Solutions & Application Support.
          • Cloud & Mobile App Development Services
        • Let’s Get
          Started.

        • Let’s talk about how SPAR Solutions
          can positively impact your business.

        • START TODAY
  • Company
    • About Us
    • Why Work At SPAR
  • Resources
    • Blog
    • Case Studies

GET STARTED 1-855-772-7765

GET IN TOUCH
  • Services
    • Salesforce Overview
      • Salesforce Overview
      • Systems Integration
      • Managed Services
      • Field Service Lightning
      • Salesforce CPQ
    • Verint Overview
      • Verint Overview
      • Verint Knowledge Management
      • Verint KM Integrations
      • Verint Omni-Channel
      • Verint Unified Desktop & Case Management
      • Verint Workforce Optimization
      • Verint Intelligent Virtual Assistant
      • Verint Robotic Process Automation
    • Artificial Intelligence
      • AI Overview
      • Data Engineering
      • Analytics/BI
      • Predictive Analytics
      • Computer Vision
      • Natural Language Processing (NLP)
      • ML Ops
    • Cloud & Mobile App Development Overview
      • Cloud & Mobile App Development Services
  • Company
    • About Us
    • Why Work At SPAR
  • Resources
    • Blog
    • Case Studies

What to do when SOQL ignores null checks on required lookup fields

Home > How to > What to do when SOQL ignores null checks on required lookup fields

What to do when SOQL ignores null checks on required lookup fields

May 13, 2021 2 Comments

SOQL ignores null checks on required lookup fields:

Suppose you have one object and some of the records are there on that object. Now when you create one new Lookup field and make it required that means all the existing records will have a null value for that new required lookup field.

SOQL seems to expect that required fields can never be null. so, it ignores null checks on required lookup fields.

The following line does not return any results:
SELECT Id FROM MySObject__c WHERE RequiredLookup__c = null
SOQL
When you set the field as not required then the same query returns the records.

Workaround:

To get the results in the query you can tweak it a little bit:
SELECT Id FROM MySObject__c WHERE RequiredLookup__r.Id = null

Workaround

 

 

 

Ali Adib
+ posts
  • Ali Adib
    https://sparsolutions.com/author/ali-adibsparsolutions-com/
    The Ins and Outs of Knowledge Management Systems
  • Ali Adib
    https://sparsolutions.com/author/ali-adibsparsolutions-com/
    Top Benefits of Salesforce and ERP Integrations
  • Ali Adib
    https://sparsolutions.com/author/ali-adibsparsolutions-com/
    SPAR’s Commitment to Diversity, Equality and Inclusion
  • Ali Adib
    https://sparsolutions.com/author/ali-adibsparsolutions-com/
    The Top 5 Key Features of Salesforce Field Service Lightning

Filed Under: How to Tagged With: Architecture, Best practices, Salesforce.com

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Apex Testing
  • Big Data
  • Force.com Development
  • General
  • Healthcare
  • Highlighted
  • How to
  • Integration
  • Knowledge Management
  • Salesforce Field Service Lightning
  • Salesforce.com
  • SFDCHighlights
  • Uncategorized

Archives

  • September 2021
  • August 2021
  • June 2021
  • May 2021
  • March 2021
  • January 2021
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • March 2019
  • June 2017
  • December 2016
  • June 2016
  • December 2015
  • November 2015
  • October 2015
  • July 2015
  • February 2015
  • January 2015
  • October 2013
  • February 2013
  • January 2013
  • December 2012

Ready to Get Started?

Let’s talk about how SPAR Solutions can help you drive greater automation

Get in Touch

Ask us how to get started today.

SPAR Solutions logo

Terms of Service

OFFICE

375 Northridge Rd
Suite #400
Atlanta, GA 30350

CALL US

1-855-772-7765

Copyright © 2020, All Rights Reserved by SPAR Solutions. Digital Marketing by