function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Server side Controller not working when using the following implement lightning:recordHomeTemplate

Any functions on the client side controller work without a problem but If i have to make a call to an apex server The function doesnt exists.
Is this a behavior that is not allowed?
public with sharing class ContactRecordHomeController {
    public static String updateStatus() {
         User user = [Select sidebar_Status__c From User Where Id = :UserInfo.getUserId()];
         user.sidebar_Status__c = !user.sidebar_Status__c;
         update user;
        return 'user';


Khan AnasKhan Anas (Salesforce Developers) 
Hi Brian,

I trust you are doing very well.

According to the information provided by you, it seems that you are using the same JavaScript method name as the Apex controller method. According to this post (, "A javascript method name in a component controller can never be the same name in an apex lightning controller".
Just need to change the name of your javascript method to be different from the apex method.

If the problem still persists, please share your complete code.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.

Thanks and Regards,
Khan Anas
Hey Khan,

I should have shared the entire code. but the client side controller names are different. I cant find any documentation on (lightning:recordHomeTemplate) limplents. I'm not sure if thats just not allowed when using the implements

<aura:component controller="ContactRecordHomeController" implements="lightning:recordHomeTemplate" description="A home page for the contact record page"
    <aura:attribute name="header" type="Aura.Component[]" description="Header region" />
    <aura:attribute name="main" type="Aura.Component[]" description="Main region" />
    <aura:attribute name="sidebar" type="Aura.Component[]" description="Collapsible sidebar region" />

    <aura:attribute name="isSidebarCollapsed" type="Boolean" access="PRIVATE" default="false" />

        <lightning:layout class="slds-m-top_medium">
            <lightning:layoutItem flexibility="auto">
            <lightning:layoutItem flexibility="no-flex">
                <lightning:button variant="base" label="Base" title="Base action" onclick="{!c.toggleSection}" class="bg-gray h-100 w-30">

                    <lightning:buttonIcon class="design-allow-interaction toggle slds-p-around_xxx-small slds-m-horizontal_xx-small absolute top-left"
                        variant="bare" iconName="{! v.isSidebarCollapsed ? 'utility:back' : 'utility:forward' }" alternativeText="{! v.isSidebarCollapsed ? 'Expand Sidebar' : 'Collapse Sidebar' }">
                    <span class="rotate-text">{! v.isSidebarCollapsed ? 'Open Sidebar' : 'Hide Sidebar' }</span>

            <lightning:layoutItem class="{! v.isSidebarCollapsed ? ' slds-hide' : '' }" size="4">
Client Side Controller:
    toggleSection: function (component, event, helper) {
        let saveSidebarStatus = component.get("c.saveSidebarStatus");
        saveSidebarStatus.setCallback(this, function (response) {
            let user = response.getReturnValue();

Apex Controller:
public with sharing class ContactRecordHomeController {
    public static String saveSidebarStatus() {
        User user = [Select sidebar_Status__c From User Where Id = :UserInfo.getUserId()];
        user.sidebar_Status__c = !user.sidebar_Status__c; 
        update user;
        return 'user';


Kunal Ghosh 17Kunal Ghosh 17
Hi Brian11,

did you find any solution for this?

Thanks in advance
Tiwari VedantTiwari Vedant
Same issue for me. Is it resolved? Please comment