
I have 2 goals here:
- get a List Value and assign to a variable.
- If record not found, do nothing, go to the next record. (This works)
if query without a list, but I get an error when a record is not found and it won't go to the next record. For example,
Account acc = [SELECT id, OwnerId, Name, AccountNumber FROM Account where AccountNumber =:ReferenceId];
Load list through query: (does not throw exception if record not found)
List<Account> acc = [SELECT id, OwnerId, Name, AccountNumber FROM Account where AccountNumber =:ReferenceId];
Access id value code (Does not work)
newcase.AccountId = acc.id;
Error:
Variable does not exist: id
Regards,
Eric2 answers