You need to sign in to do that
Don't have an account?
Matthias Kimmig
I would like to initiate a List<Account> with the result of a SOQL querry.
Hi,
I would like to initiate a List<Account> with the result of a SOQL querry. But it doesn't works.
thanks
Regards,
Matthias
I would like to initiate a List<Account> with the result of a SOQL querry. But it doesn't works.
global class UebermittlungBestellungAccount{ static Boolean checkAccountId(String accountId){ List<Account> acc = new List<Account>(); Boolean check; String aId; acc = [SELECT Name, Id FROM Account WHERE Id = :accountId]; aId = acc.get(0).Id; If(aId==accountId){ check=true; }else{ check=false; } return check; } }Could you help me?
thanks
Regards,
Matthias
try this sampe
It should works fine
thanks for your help. I have changed the code now and written a test.
I still get the following error message: DEBUG|Message: List has no rows for assignment to SObject
What can I do?
thanks
global class UebermittlungBestellungAccount{
As I understand in your code you check if Account with needed Id exists.
I search for a 18-digit Id like 0011100000UtfxUAAR.
When I search for this Id I get no result. But it should found one result.
15 digit ID case sensative
18 digit ID case INsensative, due to APEX is naturally case insensative it operates with 18-digit ID. That's why it always returns 18-digit ID(As I understand this)
I have tested the code again and again. Unfortunately, he still does not work. I belive that the list is not correct declare or initiate. The result is that the list is empty.
Do you have any other ideas or tips for me?
SELECT Name, Id FROM Account WHERE Id = 'youIdGoesHere' limit 1
I've tried to this code in developer console anonymous code and it works fine. If Query editor will return 0 rows, so the problem is with Id tha you are passing to the method.
The object must contain a row, but it has none. Could you check this, please!? thanks
Do you have "with sharing" in your class declaration where checkAccountId is placed ?