You need to sign in to do that
Don't have an account?
jOseMC
System.QueryException: List has no rows for assignment to SObject, someone help me
Hey guys, I need some help, in my code line the following error appears: "System.QueryException: List has no rows for assignment to SObject." the line that the error refers to
how do i fix it?
ServiceContract scQuery = [SELECT BankId__c, Agencia__c, Conta__c, CNPJ__c, Digito_Conta__c,Type_de_Conta_Bancaria__c, Conta_Savings__c from ServiceContract limit 1 ];
how do i fix it?
try like below. you are getting error because you are not getting any data. in this case always store data in list even you are getting only one record.
it is best practice.
don't forget to mark it as best answer.
Thank you
All Answers
Error says, you dont have any records in servicecontract object.
Can you run the same query in developer console and check, you have records or not.
If this helps, Please mark it as best answer.
Thanks!!
try like below. you are getting error because you are not getting any data. in this case always store data in list even you are getting only one record.
it is best practice.
don't forget to mark it as best answer.
Thank you