I have a related list button in Classic that isn't working in Lightning and we are still transitioning. We created a Lightning Action that calls a Lightning Component and leads to the same controller as the related list button. I was wondering if I can make the related list button work for Classic and Lightning.

In the past I have managed to create a button that opens a report in Classic and Lightning based on what the user is in.

{!IF($User.UIThemeDisplayed="Theme4d", URLFOR('/lightning/r/Report/00O1B000009TgKdUAK/view?fv0=' + Case.AccountId ), URLFOR('/00O1B000009TgKd', null, [pv0=Case.AccountId]) )}

this is the classic button. enter image description here

In Lightning we have an action that calls a Lightning Component that does the same stuff as the classic button. enter image description here

does anyone know if it is possible to call the Lightning Component if in Lightning or just call the class if in Classic?

I have updated the Aura component to have isURLAddressable and tried to update my list button but it is not working.

  implements="force:lightningQuickAction,lightning:isUrlAddressable, force:hasRecordId"
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

Button: {!IF($User.UIThemeDisplayed="Theme4d", URLFOR('/lightning/cmp/c__CAE_CloneToDependantChild?c__id={!Opportunity.Id}&c__Object=Opportunity&c__OpportunityId={!Opportunity.Id}'),

URLFOR('/apex/CloneOpportunity? Id={! Opportunity.Id } &new_url=%2F006%2Fe%3FretURL%3D%252F{!Account.Id} %26accid%3D{!Account.Id}%26opp3%3D{!Account.Name} - &CF00N30000005eGbC={! Opportunity.Name } &CF00N30000005eGbC_lkid={! Opportunity.Id} &opp3= &RecordTypeDevName=Defence_Child_Opportunity_Contracted_Follow_On_Contract &ContractType=Dependent Child') )}

  • When you say it doesn't work, what is happening? Is it navigating to the component but not behaving the way you expect? Or is it behaving in some other way? One thing that isn't clear from the snippet is if or how you're processing the query parameters from the page state
    – Jeff Kranz
    Commented Feb 12, 2021 at 18:23
  • @JeffKranz, I cannot save my list button. I am now trying to create a separate aura component for the isUrlAddressable. the list button and the lightning action should run the same code / perform the same actions. I don't think my button is right at all.
    – LMills
    Commented Feb 12, 2021 at 19:50
  • Your merge syntax is off. you've got the entire formula inside {!IF(...)}, which is fine, but then inside of that you've got additional instances of {! ... } which is unnecessary and would cause issues. once you are inside {! ... } you then only need to reference Object.Field instead of declaring {!Object.Field} every time. See the syntax in the example in my answer
    – Jeff Kranz
    Commented Feb 14, 2021 at 0:11
  • @JeffKranz, I will try this! Thank you so much for taking the time to explain what I need to do and why :)
    – LMills
    Commented Feb 15, 2021 at 13:52

1 Answer 1


If the lightning component has the lightning:isUrlAddressable interface, you can link to it with a URL button in a similar manner.

Once it has this interface, the component will also have access to the PageReference so that it can retrieve any query parameters that are added to the URL and process them or assign them to attributes in the component


You'd end up with something like this for your URL button

     URLFOR('/lightning/cmp/c__MyComponent?c__accountId=' + Case.AccountId ), 
     URLFOR('/apex/MyVFPageForClassic') )}

The important thing to note is that the component would need to be designed to handle this, it won't just allow this out of the box.

  • Hey Jeff! Thanks for your idea, I will try this. I already have a quick action that calls the component. Do you know if I would need to create a second lightning component that is URLaddressable or can I have one component that is both. <aura:component implements="force:lightningQuickAction,force:hasRecordId" extends="c:CAE_OpportunityCustomClone" > <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> </aura:component>
    – LMills
    Commented Feb 12, 2021 at 15:17
  • I have updated the Aura component to have isURLAddressable and tried to update my list button but it is not working.I posted my work above as an edit.
    – LMills
    Commented Feb 12, 2021 at 16:57
  • Just saw your edit to the question before I saw this comment- you should be able to add the interface to the same component as the quick action, but there may be behavior differences that you want to keep separate, so its really an implementation decision up to you. See my new comment on the question asking about the behavior
    – Jeff Kranz
    Commented Feb 12, 2021 at 18:25

You must log in to answer this question.

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