0

I'm trying to integrate a Custom VisualForce Page in Lightning experience and I'm facing some issues with navigation. My question is how can I detect where the user accesses my custom page from? For example:

I'm overriding the Account's Edit button so when I want to edit an Account I use my custom VF page for that. But I can access the edit page from the Account's listing page and from the record's detail page. Please see the screen shot below:

  1. Edit from Account's listing page:

enter image description here

  1. Edit from the record's details page:

enter image description here

Does anyone knows a way I can 'tell' my controller that the user is coming from the detail page or from the object's listing page so I can use this to redirect back to the relevant page? I would appreciate any help! Thanks!

2

If all you want to do is go back to the previous page, I believe you can use Salesforce one's built in navigation.(Which if I'm not mistaken, work in Lightning experience as well)

Using:

sforce.one.back(true); // I should note this is a Javascript function, not Apex

As noted in the documentation here, it is equivalent to hitting the browser's back button. And the parameter true in my example is optional and indicates whether you'd like the page to refresh.

Hope this helps!

  • 1
    Thanks for the quick response. I'll try and give a feedback. – vortex Jan 14 '16 at 14:52
  • Although it's not exactly what I was looking for I was able to achieve what I want. Thanks! – vortex Jan 15 '16 at 7:10
  • @vortex, can you please share how did you achieve it? Thanks! – Quest_sfdc Nov 28 '18 at 21:41

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.