You need to sign in to do that
Don't have an account?
SeAlVa
Odd behavior in Test Classes
Hi there!,
I'm having an exception (CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY) in my code when I change from this code
to this one
What might be the explanation? (that is the ONLY thing I am changing, and tests are running OK without this change)
Thanks in advance
I'm having an exception (CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY) in my code when I change from this code
public void recalculateAccountSegmentation(List<Opportunity> lOppty){ List <Account> accounts = new List <Account>(); List <Account> acctoupdate = new List <Account>(); for(Opportunity o: lOppty){ accounts.add(o.Account); } acctoupdate = [Select Id from Account where Id IN: accounts]; update acctoupdate; }
to this one
public void recalculateAccountSegmentation(List<Opportunity> lOppty){ Set <Account> accountsSet = new Set <Account>(); for(Opportunity o: lOppty){ accountsSet.add(new Account(ID=o.AccountID)); } update new List<Account>(accountsSet); }
What might be the explanation? (that is the ONLY thing I am changing, and tests are running OK without this change)
Thanks in advance
Thanks for the quick reply, anyway.
All Answers
List<Account> Acctlist = new List<Account>(accountsSet);
udpdate acctlist'
Let me know the results.
Thanks for the quick reply, anyway.