You need to sign in to do that
Don't have an account?

syntax to clone with child record
hi guys,
any body has an idea of the syntax to clone a opportunity with its product
my idea is bit with child record
opportunity opp_clone= opp.clone ;
Insert opp_clone;
Thank you
any body has an idea of the syntax to clone a opportunity with its product
my idea is bit with child record
opportunity opp_clone= opp.clone ;
Insert opp_clone;
Thank you
Thank you
I want to clone the Opportunitylineitem from a trigger on opportunity after insert
trigger Oli_update on Opportunity (After insert) {
List<OpportunityLineItem> updatedoli = trigger.new.OpportunityLineItems.deepclone(false);
for (OpportunityLineItem oli : updatedoli) {
oli.OpportunityId = trigger.new.Id;
oli.Quote_Reference__c= null;
oli.ServiceDate= null;
updatedoli.add(oli);
}
update updatedoli;
and I get this error Message
Error: Compile Error: Initial term of field expression must be a concrete SObject:
Other wise my real issue is to write a test method to test my update on the opportunitylineitem this update is fire by a trigger after insert on the opportunity
I get only 17 % coverage
The idea is when I clone a opportunity. I have to clear some field at the opportunity level. It works but my test method does not go into the opportunityline item iteration (80 %) of my classes. so I can not deliver my jobs in production.
I think I need to do insert of my opportunity with my opportunitylineitem in one block. Otherwise when the trigger is fire the opportunityline item are not here .