I am trying to implement a custom button on a record detail page that does the following:

  • redirect user to custom lightning component with querystring: ?projectId=...

I am using the following settings:

  • Detail Page Button
  • Display in new window
  • URL
  • {!URLFOR("/lightning/n/AccountProjects", null, [projectId=Project__c.Id])}

It works ... sort of.

All is well when I first test the button. If I click on the button with a record id of a0E5C0000075ivxUAA, I successfully redirect to ...?projectId=a0E5C0000075ivxUAA.

But if I go back to a new record, click the button, I still get redirected to the old projectId, instead of the new Id.

The only way to fix this is if I hard refresh (Cmd+Shift+R).

Why does this happen? Could it be a caching issue?

  • Is URL changing when you click on the button after going to other records? Does URL have new id present? If yes, can we have your component code here? That would be helpful. Nov 27, 2018 at 9:33
  • @VivekMakkar Thanks for the quick response. It was a weird issue where reloading the page would not execute the init function for my component. My guess is the component is remaining in memory and when a user gets re-directed back to the component page, it skips the init function and executes a re-render instead. Nov 29, 2018 at 21:00

1 Answer 1


After speaking with my team, we decided to implement a custom redirect component and assign this as a Lightning Quick Action on the record detail page.

It was a bit of extra work creating a new component and writing the redirect logic, but it works like a charm.

  • I tried the approach of Using URL in My Developer Edition org. And i was able to redirect all the time from each record. I Used lightning:isUrlAddressable in component which is supposed to open. Maybe you have used that too i think. Nov 30, 2018 at 5:14

You must log in to answer this question.

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