Skip to content

Instantly share code, notes, and snippets.

@dancinllama
Created April 17, 2013 13:20
Show Gist options
  • Save dancinllama/5404238 to your computer and use it in GitHub Desktop.
Save dancinllama/5404238 to your computer and use it in GitHub Desktop.
Apex code for implementing a custom clone quote button for Big Machines related work. The following takes a child opportunity and clones the Big Machines quote from the parent object onto the child opportunity
PageReferene pageRef = Page.BigMachines__QuoteEdit;
Map<String,String> parms = pageRef.getParameters();
//Get First (Primary) Big Machine Quote From current Opportunity's parent opportunity
parms.put('Id',parentOpp.BigMachines__BigMachines_Quotes__r.get(0).Id);
//Clone the parent into the the current aka child opportunity.
parms.put('oppId',opp.Id);
parms.put('clone','true');
return pageRef;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment