4

I have a lightning component that overrides the view action on Contact and redirects the user to the Account detail page. It works well in Lightning Experience and Salesforce1 mobile app but does not work in Community (partner central template). For brevity, I have minimized the code to the bare bones relevant for the question. Am I missing something?

Component

<aura:component controller="ContactController"
implements="forceCommunity:availableForAllPageTypes, lightning:actionOverride, force:hasRecordId">

<aura:attribute name="accountId" type="String" default="0010l000005qbUiAAI" />
<aura:dependency resource="markup://force:navigateToSObject" type="EVENT"/>

<aura:handler name="init" value="{!this}" action="{!c.redirectToAccount}"/>

Controller

({
    redirectToAccount : function(component, event, helper) {
        var accountId = component.get('v.accountId'); 
        helper.moveToAccount(accountId);
    }
})

Helper

({
    moveToAccount : function(accountId) {
        var navigate = $A.get("e.force:navigateToSObject");
        navigate.setParams({'recordId': accountId});
        navigate.fire();
    }
})

1 Answer 1

1

The docs for the lighnting:overide mention to work only for lighnting experience and SF1 .

It does not mention for communities .Communities lightning container is quite different and hence I fear this is not yet supported for communities .

5
  • I guess op can use a visualforce with lightning out to override the view?
    – Raul
    Commented Nov 19, 2017 at 8:41
  • Never thought about that, let me give it a shot @RahulSharma
    – DCBoy
    Commented Nov 19, 2017 at 14:22
  • @RahulSharma tried creating a vf page with lightning out and configured the View override to use the vf page but on Community, the page just did not get loaded. So am afraid that this is not yet supported for Communities.
    – DCBoy
    Commented Nov 20, 2017 at 1:40
  • @DCBoy ya even vf override is not supported as far as I know .I think worth opening an idea and looks like you may need to create your own custom component Commented Nov 20, 2017 at 1:44
  • any example workaround for this yet? Commented Jun 21, 2018 at 12:12

You must log in to answer this question.

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