+ Start a Discussion

Custom cloning product list on for an opportunity?

Hi I have code that successfully clones the opportunity related list for opportunity partner.  Now that we have included products for the opportunity I see a new button that has a little picklist option arrow on it.  This is built in and allows cloning the opportunity by itself or with the products. 


This is an issue for my custom cloning button that was cloning the opportunity with related partner record(s)!

I posted that code at: http://boards.developerforce.com/t5/Apex-Code-Development/Code-behind-the-Clone-Button/m-p/201476#M34627


Does anyone have code that clones the related products for a given opportunity?  I need to override the default clone button or hide it and use my own and figure out how to incorporate my code and the products cloning code so that all records successfully save or roll-back.


Does anyone have cloning code for products or another related list likeattachments, activities etc?  Products is on the plate now but I can see the future where users want to clone more related data!!!


Hi Tom


How did you get on with this?  I have a similar requirement to clone Opoortunities with Products and a  related list (custom object with master-detail relationship)






There is this wonderful starter code out on Code Share (http://developer.force.com/codeshare/projectpage?id=a0630000004uCARAA2).  The code title is 'Opportunity Renewal Wizard'.


I have not used it in our test environment at this point in time; however, I installed it in a developer environment and updated the version from 16 to 20 (current) and it works as described.


I briefly looked at the code and I am confident with a day of trial and error I will be able to add additional logic for my specific related objects.  I hope you are able to do the same.


Things are changing all the time hear so I am not sure when I will be picking this effort back up but if there is a need and I add additional logic I will post it in this feed.   Maybe you could do the same.  This way we can help others who may be dealing with the same issues. 


I just commented on Sabastian's work (I am known as inacloud there and Eager-to-learn here  but can't remember why).


I hope his code jump starts you to success.


Thank you very much for the link.


It has indeed given me a jump start, I have already managed to get it to create the cloned opportunity with the the custom related list.


I look forward to working through this with my client to establish exactly which fields they are going to require to clone.


Furthermore with this code I can get the client to start thinking about their renewal opportunities and how they can improve their process and therefore hopefully their renewal rates.


Thank you again