You need to sign in to do that
Don't have an account?
Cannot figure out this error - CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY
I actually understand what the error is telling me - I just cannot figure out how to fix it.
I have this trigger on the Opportunity: And it works perfectly...
trigger OpportunityUpdateAccount on Opportunity( before insert, before update ) { List<Account> accsToUpdate = new List<Account>(); for(Opportunity opp : trigger.new){ if (opp.Stage_Calc__c != null && opp.Amount >= 50000 && (opp.type.contains('New Business') | (opp.type.contains('Existing Business')))) accsToUpdate.add(new Account(Id = opp.AccountId, Active_Opp_over_50kcalc__c = true)); else if (opp.Stage_Calc__c == null && (opp.type.contains('New Business') | (opp.type.contains('Existing Business')))) accsToUpdate.add(new Account(Id = opp.AccountId, Active_Opp_over_50kcalc__c = false)); } if (accsToUpdate != null) update(accsToUpdate);
However, when I add this trigger: it breaks giving the error below the code...
trigger partnerOpClone on Opportunity (after update) { Opportunity opp = [select Id, closedate from Opportunity where StageName = '09-Win' and type = 'Reseller / Partner Registration' LIMIT 1]; Opportunity newOpp = opp.clone(false, true); newOpp.StageName='trainging'; newOpp.amount=null; newOpp.name=account.name + 'partner'; newOpp.closedate=opp.closedate; insert newOpp; }
Error:Apex trigger partnerOpClone caused an unexpected exception, contact your administrator: partnerOpClone: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OpportunityUpdateAccount: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] Trigger.OpportunityUpdateAccount: line 12, column 1: []: Trigger.partnerOpClone: line 8, column 1
I get that the error is telling me there is an issue with the insertion and the other trigger firing - I have tried multiple things to fix it, but I am completely stummped. Any help would be appreciated.
In this line
"newopp.Name = account.Name +'Partner'" You didn't query account.name in soql query to get opp.
You can odify the query
try changing
to this..
Thanks, I tried both of those and they worked, i can now save the opp with no errors - but I have a new problem - after I get the first op to clone, when I try cloning other ops from other accounts it always clones the first op again. So I have multiple clones on one account and none on the other accounts.
:(
Does anyone know how I can resolve the issue with this cloning ops to only the first account associated with the first op? ANy help would be appreciated.