You need to sign in to do that
Don't have an account?
Logu
System.QueryException: List has no rows for assignment to SObject
HI,
I am new to salesforce, Can any one help me to fix this issue. I am trying to write test class for updating the record using standard controller, and extension .I am getting exception in objAccount , which throws System.QueryException: List has no rows for assignment to SObject.
I can get the results in query editor by executing 'select name, owner.name, site ,id, Industry from account where id = '0019000001FYa8GAAT' ' this query ,
Account objAccount = [select name, owner.name, site ,id, Industry from account where id = '0019000001FYa8GAAT' ];
ApexPages.StandardController sc = new ApexPages.standardController(objAccount);
myPageCon = new AccountEditPageCon(sc);
Please help me to fix this issue. Thanks in advance
I am new to salesforce, Can any one help me to fix this issue. I am trying to write test class for updating the record using standard controller, and extension .I am getting exception in objAccount , which throws System.QueryException: List has no rows for assignment to SObject.
I can get the results in query editor by executing 'select name, owner.name, site ,id, Industry from account where id = '0019000001FYa8GAAT' ' this query ,
Account objAccount = [select name, owner.name, site ,id, Industry from account where id = '0019000001FYa8GAAT' ];
ApexPages.StandardController sc = new ApexPages.standardController(objAccount);
myPageCon = new AccountEditPageCon(sc);
Please help me to fix this issue. Thanks in advance
Please add this in first line of your test class. Please mark this as answer as solution if that resolves your issue.
@isTest(SeeAllData=true)
e.g.
@isTest(SeeAllData=true)
public class TestDataAccessClass
{
}
All Answers
Please post your class and Test class code so that we can tell you corrections instead of writing everything from scratch.
Thanks,
Himanshu
Please add this in first line of your test class. Please mark this as answer as solution if that resolves your issue.
@isTest(SeeAllData=true)
e.g.
@isTest(SeeAllData=true)
public class TestDataAccessClass
{
}