1

we are moving from classic to lightning interface, i have a custom button which calls a VF page which clones an existing record and makes some changes to the record and then opens a record in edit mode. Here is the code i am using to open the record in edit mode.

return new pageReference('/'+clonedopp.id+'/e');

These work fine as expected. The only issue is that when we click save button, it doesnt redirect to the view screen of saved record.

So my question is, is there a way i can view the edited record once the save is clicked. Right now it just shows a blank page.

1

The URL in LEX does not actually change when editing a record (instead, a modal is opened), so explicitly appending the '/e' to the URL results in a broken page.

You can fire the force:editRecord event in your client-side controller with the recordId as a parameter; this will open the edit modal in LEX.

var editEvent = $A.get("e.force:editRecord");
editEvent.setParams({
    "recordId": <insert record Id here>
});
editEvent.fire();
-1

Use force:navigateToUrl in LEX.

var uRLToLaunch= '/'+clonedopp.id+'/e';
var urlEvent = $A.get("e.force:navigateToURL");
     urlEvent.setParams({
            "url": uRLToLaunch
     });
     urlEvent.fire();
  • unless I'm misunderstanding OP's question, this answer does not work - the URL in LEX does not actually change when editing a record, so appending the '/e' results in a broken page. – Brian Mansfield Jul 9 '18 at 19:24
  • my understanding was the edit page is a VFpage ovverride and it should works with appending '/e'. – Nithun Jul 9 '18 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.