Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

Salesforce – List has no rows for assignment to SObject

Be First!
by February 18, 2013 APEX, SALESFORCE, SOQL

Salesforce – List has no rows for assignment to SObject

if you using following code in Apex and Error should throw like “List has no rows for assignment to SObject”.

Account a = [Select name from acoount where id =: strId];

Try to avoid the error following code in you Apex.

List<Account> lstAccount = [Select Id, name from acoount where id =: strId];

if (lstAccount.size() > 0) {
    String Name = lstAccount[0].Name;
}

(1144)

Previous
Next

Leave a Reply