We are working to override the standard edit button with a LWC that will check if the user has edit access or not before proceeding to the edit page.

Basic functionality is working but one challenge we are facing is on returning the user to the correct location - list view, record detail, or related record.

Is there a way to know if a user is clicking edit on a list view or on a record detail? And if its a list view - to know which list view they are on?

The only solution I have come up with so far is to use a custom button on record detail, which would return to record detail. The list view edit button always uses standard edit, so we can return them to the object list views - though I believe it would open the pinned list view, not the most recently used one. And this requires two buttons - one for detail and one for list view. Ideally we could just use one override, which would know where the user is coming from.


1 Answer 1


You can use the window function in JS.


Which will take the user back, exactly where he was.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .