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
Jane Marchand 15Jane Marchand 15 

Order Product Custom Clone Button

I am trying to create a custom clone button on Order Product.

The code I am using is as follows

All appears to function correctly until such time as I try to save this new record. I then get the following error:

User-added image
Of which the URL is:

Is there any way I could reference the OrderId in the RetURL? I think that may fix the problem.


Tejpal KumawatTejpal Kumawat
Hello Jane,

You need to add &retURL={!OrderItem.OrderId} in the button URL.

Tej Pal Kumawat
Skype : tejpalkumawat1991

If this answers your question mark Best Answer it as solution and then hit Like!
Jane Marchand 15Jane Marchand 15
Hi Tejpal

I tried that but getting an error in the formula builder.
See below.
I also tried changing the RetURL to be &retURL={!OrderItem.Order.Id} but get the same error....

User-added image

You want to add the retUrl parameter to your URL

You can read a great blog about this here (
Jane Marchand 15Jane Marchand 15
I'm afraid that does not work either....
What about the suggestion doesn not work?
Jane Marchand 15Jane Marchand 15
I'm getting the same URL No Longer Exists error as above
Have you tried it in an org? Is it working for you?


You can write below code and select java script behaviour.

window.location.href = '/{}/e?clone=1&retURL=%2F{}&isdtp=mn';

Ashlekh Gera
Irene SlessIrene Sless
Jane, did you get this work? I've tried all the suggestions I've found, but none of them work. It just doesn't seem to clone the OrderItem - the links given only open the OrderItem selected in edit mode, not as a New OrderItem cloned from the original to be saved. The retURL part was easy to fix, it's the cloning that doesn't work for me...
Mina Michel GorgyMina Michel Gorgy
Hi Irene Sless, looks like you're right. Did you find a workaround for it? I'll be still looking until I find a way out. Let me know please.