Apex error 'List has no rows for assignment to SObject'

The following query is not returning any number of records: "[SELECT Id FROM Account WHERE Id = :Trigger.new[0].Account__c]" The error "List has no rows for assignment to SObject" occurs when query doesn't return any rows.

Company Logo

Cookie Consent Manager

General information, required cookies, functional cookies, advertising cookies.

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings. Privacy Statement

Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.

Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.

Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.

Cookie List

IMAGES

  1. Salesforce: System.QueryException: List has no rows for assignment to

    system queryexception list has no rows for assignment to sobject n nclass

  2. Salesforce: Visualforce System.QueryException: List has no rows for

    system queryexception list has no rows for assignment to sobject n nclass

  3. System.QueryException: List has no rows for assignment to SObject

    system queryexception list has no rows for assignment to sobject n nclass

  4. System.QueryException: List has no rows for assignment to SObject for

    system queryexception list has no rows for assignment to sobject n nclass

  5. Getting "System.QueryException: List has no rows for assignment to

    system queryexception list has no rows for assignment to sobject n nclass

  6. System.QueryException: List has no rows for assignment to SObject

    system queryexception list has no rows for assignment to sobject n nclass

VIDEO

  1. STD 9 Assignment Solution Part 4 Sanskrit ||Std 9 Assignment Solution Section D English Medium

  2. std 9 maths assignment solution 2024 vibhag C chapter 9| dhoran 9 ganit assignment solution vibhag C

  3. Handling SOQL Queries with no results 😶

  4. Names linked to Jeffrey Epstein to be released

  5. CS609 System Programming Assignment 2 Fall 2023 Virtual University of Pakistan

  6. TOP 4 OTS [March 2024]: Sky Striker Deck Profile (Yu-Gi-Oh TCG)

COMMENTS

  1. Apex error 'List has no rows for assignment to SObject'

    What’s not obvious is that it also assumes that exactly one row is returned! Although this is unlikely to occur for Contact, it is highly likely to occur for any custom objects you create, especially when a WHERE statement is used that might return zero rows, such as: