You need to sign in to do that
Don't have an account?
TC Admin
Redirect User to newly created clone opportunity once finished editing
Hi All, I have a Apex class and VF Button that Clones an opportunity while overwritting certian fields.
Before lightening the user would be re-directed to their newly created opportunity after they press save on the edit page.
However since Lighting have taken away teh URL hacking it does not work.
Original URL hack:
I have dones some research and found I can use the below code however this BYPASSES the edit screen and takes them directly to the new cloned opportunity. meaning people cannot edit the new clone before actually saving.
Any ideas how I can combine the two so that when the user presses "Clone with items" They are taken to an edit screen. Once they press send they are taken to to newly created clone not just a blank page?
Before lightening the user would be re-directed to their newly created opportunity after they press save on the edit page.
However since Lighting have taken away teh URL hacking it does not work.
Original URL hack:
return new PageReference('/'+newOP.id+'/e?retURL=%2F'+newOP.id);
I have dones some research and found I can use the below code however this BYPASSES the edit screen and takes them directly to the new cloned opportunity. meaning people cannot edit the new clone before actually saving.
return new PageReference('https://cs109.lightning.force.com/'+newOP.id);
Any ideas how I can combine the two so that when the user presses "Clone with items" They are taken to an edit screen. Once they press send they are taken to to newly created clone not just a blank page?
Greetings to you!
You can use return new PageReference('/'+newOP.Id);
Below is the sample code to edit opportunities and it is working fine. Kindly modify the code as per your requirement.
Visualforce:
Controller:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
1 . lightening PageRefernce URL redirect doest work so i can suggest to create a create a component and do it ..
2. Create a ligning compoenet to clone the records after clone the record navigate the lightning component using navigration APi and URL Addressable interface
Hi Raj Vakati I already have an apex code to clone the ops how do i use API anf URL addressable interface within the apex coding?