0

Trying to create an Action button to be placed on the record detail page, I want the functionality as click on that button, lightning component URL should open in a new window.

Using this link: /lightning/cmp/c__NewCase?recordId=Id which is opening in that tab itself while window open behavior is set to be open in a new window.

  • add picture of your button behavior? Standard Button by default open Lightning component in Dialog box – Dhanik Lal Sahni May 31 at 11:10
0

in your case you should use lightning:workspaceAPI please use below solution and post if you get any errors. refer doc for workspaceAPI

cmp

<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<lightning:workspaceAPI aura:id="workspace" />
<lightning:button label="Open Tab" onclick="{! c.openTab }" />
</aura:component> 

controller.js

{(
openTab : function(component, event, helper) {
    var workspaceAPI = component.find("workspace");
    workspaceAPI.openTab({
        url: "/lightning/r/c__NewCase/+'yourrecordid'+/view",   // you should pass your recordId at yourrecordid
        focus: true
    }).then(function(response){
       // if any actions needed after opening a tab
    }).catch(function(error){
       console.log(error)// catch if any errors happened 
    });
},
)}
  • I can agree with the above method, but I want to open component with the button on the record detail page. So that I can set URL of my lightning component to be open and this component will open in new window or tab. – Ashish Malikar Jun 5 at 13:54
  • can you post what you have tried so far, otherwise you want get much help from community. – sdandamud1 Jun 5 at 14:10

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.