8

Is there any way to make force:navigateToSObject event to open sObject in new tab?

7

Yes, You can navigate to new tab using-

<aura:handler event="force:navigateToSObject" action="{!c.navigateToRecord}"/>

navigateToRecord : function(component , event, helper){
    window.open('/' + event.getParam('recordId'));  
},
  • From where do you fire this event? – Sarang Jul 29 '17 at 8:16
  • From a custom lightning component. – Ajay Prakash Dubey Jul 29 '17 at 8:17
  • You fire it and catch it in the same component. Probably be a good idea to cancel the event too – Caspar Harmer Jul 29 '17 at 8:17
  • 1
    I think you also need to add '_blank' as the second param to window.open() – Caspar Harmer Jul 29 '17 at 8:19
  • I knew the record Id, so when I directly used window.open('/' +recordId) it works. So is it OK to skip the navigate standard event? – Sarang Jul 29 '17 at 8:21

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.