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();
}
})