Skip to main content
I'm getting this error:

There was an unexpected error in your org which is preventing this assessment check from completing: System.QueryException: List has no rows for assignment to SObject

However, I have set and saved the described reputation levels. What am I doing wrong?
3 respuestas
  1. 7 jun 2018, 7:40
    Hi Joshua,

    Mark as best answer, If it resloves !!

    Their error will occur when query does not return rows. I have given sample code below to understand

    Account a = [select id, name from Account where name = 'test'];

    Instead of using this we should use like that

    List < Account > lstAccount  = [select id, name from Account where name = 'test'];

    if(lstAccount.size() > 0) { 

    Account a = lstAccount.get(0);

    }

    If need more information on your code please post your code here to debug us more.

    Mark as resloved if it helps :) :)

    Thanks, 

    Bhanu Prakash

    visit ForceLearn.com​   
0/9000