You need to sign in to do that
Don't have an account?
Krishna Prasad K P
How to get the parent opportunity ID in the trigger while clonning..??
Hi All,
I have a before insert trigger on opportunity.
I have a new requirement :
When user clones an opportunity I need to get some field values from the parent opp, and after some calculation on these values, the result has to be set to a field in the opportunity being inserted. Also some fields have to be copied from the parent opp to the new child opp.
Problem is that, almost all these fields are not in the layout. So clonning doesnt copy those fields to the child opp. So these fields have to be queried from the parent opp using SOQL.
Inserting parent opp ID into any of the input field on edit mode is not preferred!!(like https://na9.salesforce.com/<parentID>/e?clone=1&retURL=<retURL>&<fieldname>=<parentID>)
*** How can I get the ID of the parent opportunity in the trigger ?????? ****
Kindly provide me a solution..
Thanks in advance,
Thanks in advance,
Krishna
I use the following opportunity trigger after insert to update the opportunitylineitem record of a specifique opportunity :
trigger opportunity_after_insert on Opportunity (after insert) {
Opportunity[] opps=Trigger.new;
opportunity_clone.Opp_line_item_del(opps);
}
This trigger call opportunity_clone.Opp_line_item_del
I still have an issue my test method does not execute the iteration on the opportunity line item.
When I use my clone button the trigger is execute after the opportunityline item . but with my test method :
insert the opportunity then call my trigger ( when there is no opportunitylineitem ) and then it insert the opportunity line item .
So test covarage result is 17 %