function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Update parent Opportunity with child Opportunity values

Hey everybody,

Could you please give me some advice with this:

We are creating child opportunities (cloning products too) with a custom button. When one of the child opportunities' stage is changed to closed/won, should this "winning" child update its parent opportunity.

Child opportunity has a look-up relationship to its parent.


I though that we could use another custom button to do the update with URLFOR code (a lot like the URLFOR we have for cloning the parent opportunity in the beginning). But the problem is that the button actually creates a new opportunity, not updates the "old" one.


What do you think, is a trigger the only way to update a parent?


Best Regards,


A trigger would definitely be the best way to do this.  Also, do you really want to change the parent opportunity to closed/won when _one_ of the children is set to closed/won, or _all_ of them?  Just a thought.

Hello werewolf,

I don't want parent opportunity stage to change to closed/won. When one of the child's stage is closed/won, all the other children will be closed/lost. And the parent (stage) will be "Order from the client" when updated from the child.


So I'm trying to do this with urlfor and a custom button. I would need to add the parent opportunity id to syntax, but that might be unpossible to do. Other thought is to use $Action.Opportunity.edit instead of the clone. There I'm able to add parent opportunity id and update its fields, but then again, I don't get my products to follow. User may change / add more products at the child opportunity, and these changes have to be updated too.


This is my urlfor (clone)


{!URLFOR( $Action.Opportunity.Clone ,  Opportunity.Id,
opp11="4 Order from the client",
opp3= Opportunity.Parent_Opportunity__c ,


Parent opportunity is different record type than its children. That information is also added to code.


Is there a trick to add that parent to this clone or use edit and get opportunity products also updated?

If not, what would be the best (easiest?!) way to start writing a trigger for this purpose?


Best Regards,



Message Edited by TigerPower on 06-12-2009 01:33 PM

A trigger is still the best way to do this -- I'm not really sure how that URLFOR is working but it strikes me as being somewhat fragile.


As for where to start in writing the trigger, there's a fair bit of sample code here that updates parent records from a child and vice versa.