You need to sign in to do that
Don't have an account?
Rodolfo Calvo 3
Update one account owner
Hello team I have the following:
These variables are taken from a two different selectLists
But at clicking the button in visual force the system shows me the following error:
Thanks in advance.
public void mergeOwners() { String a1; String a2; a1 = sGetOwnerOne; a2 = sGetOwnerTwo; Account src = [SELECT Owner.Id FROM Account where Name like :a1]; Account dest = [SELECT Id, Owner.Id FROM Account where Name like :a2]; dest.OwnerId = src.OwnerId; update dest; }
These variables are taken from a two different selectLists
public static String sGetOwnerOne{set;get;} public static String sGetOwnerTwo{set;get;}
But at clicking the button in visual force the system shows me the following error:
List has no rows for assignment to SObjectDoes somebody know why this happens?
Thanks in advance.
May be any of list is not returning any record, that's why it is throwing exception. Use the below code instead of the above two queries: For using these records, first check the size and then use the first index like below: Let me know, if you need any other information.
Thanks,
Neetu
All Answers
May be any of list is not returning any record, that's why it is throwing exception. Use the below code instead of the above two queries: For using these records, first check the size and then use the first index like below: Let me know, if you need any other information.
Thanks,
Neetu