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

Cloned Opportunity returning to edit page without parameters when validation fails

Problem:  I have overwriten the "Clone" button for the opportunity object.  I pass parameters to the newly created opportunity via the URL.  If validation rules fail when the user clicks "Save", then salesforce redirects the page to  this is the edit page for the newly created opportunity, but doesn't have my variables.  The reason this is a problem is because one of my varialbes is  "cloneli=1"  This allows me to clone the line items of the opportunity.  When Salesforce redirects me to, the "Save" button becomes "Save & Add Deliverables", which means it isn't cloning the Opportunity LineItems anymore.

BTW, Deliverables, is our name for Opportunity LineItems.

The code below works fine if validation is passed on all fields when the user clicks "Save".  The Opportunity Line Items are also cloned.  As stated, the problem is if the user makes an error or doesn't put in a required field on the cloned opportunity and then they try to save it, then Salesfoce redirects them to the following URL  All my variables that I added to the URL are stripped!

How can I get the same variables I passed when I clicked the "Clone" button to show up if validation fails when the user clicks the "Save" button in the newly created cloned opportunity?

Note: The "options" variable below are the parameters I pass to the URL and the newURL variable is the actual URL that gets called.

     var options = "&opp7=0&opp11=&00N50000001TsuZ=0&00N300000018Fd8=0&00N50000001gfzh=&00N50000001TsuZ=0&00N50000001QPD1=0&00N50000001hD8t=0&00N50000001hD8Z=0&retURL=/" +  "{!Opportunity.Id}" ;

var newURL =""+ "{!Opportunity.Id}" + "/e—clone=1" + options + "&nooverride=1&cloneli=1";