function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dennis Warner2Dennis Warner2 

Convert a url button to a lightning component.

Hello, I've been working to convert this url button: 
into a lightning component.  I've already built the component button, but i don't know where to put the above url.  In controller?  How would that look?  I've tried figuring it out on trailhead, but it'll take another week before it answers my question.  Any answers would be appreciated.
pradeep kumar yadavpradeep kumar yadav
Hi Dennis,

You can use isUrlAddressable interface to call lightning component and pass parameters to it.
Dennis Warner2Dennis Warner2
I'm sorry, Pradeep.  What you've sent is something a developer could digest easily i'm sure.  The link you've sent looks like a foreign language to me, however.  
pradeep kumar yadavpradeep kumar yadav
Add this interface in your lightning component that you created like
<aura:component implements="lightning:isUrlAddressable">

add this handler in your lighting component

<aura:handler name="change" value="{!v.pageReference}" action="{!c.onPageReferenceChange}"/>

replace url in your button with this url


Add this method in lightning component controller js---
onPageReferenceChange: function(cmp, evt, helper) {
        var myPageRef = cmp.get("v.pageReference");
        var id = myPageRef.state.c__id;
        var objectName = myPageRef.state.c__Object;
//Use these variable values in your component

Note:- If the link look like foreign language to you then,who created the lightning component? Ask him to follow the above steps.
Sandhya Narayanan 10Sandhya Narayanan 10
Hi Dennis,
Were you able to resolve this issue? I too am trying to create the SDOC link from a lightning component.