Advanced Mode
2. Custom LC Wrapper - Cont’d
Sample use case:
1. Display My Open Cases on the Home Page
○ homeMyOpenCases.cmp (sample only)
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome" access="global" >
<aura:attribute name="userId" type="String" />
<aura:attribute name="showComponent" type="Boolean" default="false" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:if isTrue="{!v.showComponent}">
<CMTD:EnhancedRelatedList objectAPIName="Case" relatedListName="Test Open Cases"
parentField="OwnerId" parentId="{!v.userId}"
displayType="Tile 1" layoutType="1 Column"
sort="CreatedDate DESC" filter="Status!='Closed'"
defaultNumberofRecordsToDisplay="2" title="My Open Cases"
iconName="standard:case"
showHeader="true" showRefreshButton="true" />
</aura:if>
</aura:component>
○ homeMyOpenCases.js (sample only)
({
doInit : function(component, event, helper) {
var userId = $A.get("$SObjectType.CurrentUser.Id"); // hint: call server controller for other fields
component.set("v.userId", userId);
component.set("v.showComponent", true);
}
})