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
sakthidharan Ambayiramsakthidharan Ambayiram 

This page has an error. You might just need to refresh it. Unable to find action 'SaveRecord' on the controller of c:ToDoList Failing descriptor: {c:ToDoList}

I am new to lightning, not able to find the root cause
Issue 1: eventhough populated the Due date ,reminder date is read only
Issue 2. On click of create task button, getting the bloe error.
PFB code.

*****************component********************
<aura:component controller="ToDoController" implements="flexiPage:availableForAllPageTypes">  
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="toDoColumns" type="List" />
    <aura:attribute name="toDoData" type="Object" />
    <aura:attribute name="today" type="date" />
    <aura:attribute name="objToDo" type="ToDo__c" default = "{'sObjectType' : 'ToDo__c'}"/>
    <lightning:card title="Add New Task" >
       <aura:set attribute="actions">
            <lightning:buttonicon iconName="utility:chevrondown" alternativeText="down icon" onclick="{!c.toggleForm}"/>
        </aura:set> 
        <div aura:id="form" class="slds-size_1-of-1 slds-p-around_medium">
        <lightning:textarea type="String"
                            label="Task Description" 
                            value="{!v.objToDo.Description__c}"
                            required="true"
                            messageWhenValueMissing="Enter Description" />
         <lightning:input type="Date"
                         label="Due Date"
                         value="{!v.objToDo.Due_Date__c}"
                         required="true"
                         messageWhenValueMissing="Enter Due Date"
                         min="{!v.today}"
                         onChange="{!c.setMaxValueOfReminderDate}" />
        <Lightning:input aura:id="ReminderDate"
                         disabled="true"
                         type="Date"
                         label="Reminder Date"
                         value="{!v.objToDo.Reminder_Date__c}"
                         min="{!v.today}" />
        <lightning:button class="slds-m-top_small"
                          label="Create Task"
                          variant="brand"
                          onclick="{!c.saveToDo}" />
        </div>
        <lightning:datatable keyField="Id"
                             columns="{!v.toDoColumns}"
                             data="{!v.toDoData}"
                             hideCheckboxColumn="true" />
    </lightning:card>
</aura:component>
****************************controller*****************************
({
    doInit : function(component, event, helper) {
        var now = new Date();
        var date = now.getDate();
        var month = now.getMonth() + 1;
        var fullYear = now.getFullYear();
        var today = fullYear + '-' + month + '-' + date;
        component.set("v.today",today);
        component.set("v.toDoColumns",[
            {
                label: 'Description',
                fieldName: 'linkToRecord',
                type: 'url',
                typeAttributes:{label:{fieldName: 'Description__c'},target: '_blank'}
            },
            {
                label: 'Due Date',
                fieldName: 'Due_Date__c',
                type: 'date',
                typeAttributes:{day:'2-digit',month:'long',year:'2-digit'}
            },
             {
                label: 'Reminder Date',
                fieldName: 'Reminder_Date__c',
                type: 'date',
                typeAttributes:{day:'2-digit',month:'long',year:'2-digit'}
            }
        ]);
       // helper.getData(component,event,helper);
    },
    toggleForm : function(component, event, helper) {
        var evesource = event.getSource();
        if(evesource.get("v.iconName") == 'utility:chevrondown'){
            evesource.set("v.iconName",'utility:chevronright');
        }else{
            evesource.set("v.iconName",'utility:chevrondown');
        }
            $A.util.toggleClass(component.find("form"),'slds-hide');
    },
    saveToDo : function(component, event, helper) {
        var objtodo = component.get("v.objToDo");
        var action = component.get("c.SaveRecord");
        action.setParams({
            ToDoRecord : objtodo
        });
        action.setCallback(this,function(response){
            var successstate = response.getState();
            if(successstate ==     "SUCCESS"){
                var toastref = $A.get("e.force:showToast");
                if(response.getReturnValue() == null){
                    toastref.setParams({
                        "type" : "Success",
                        "title" : "Success",
                        "message" : "New Task is Created.",
                        "mode" : "dismissible"
                    });
                }
                    else{
                        toastref.setParams({
                            "type" : "Error",
                            "title" : "Error",
                            "message" : response.getReturnValue(),
                            "mode" : "sticky"
                        }); 
                    }
                    toastref.fire();  
            }
        });
        $A.enqueueAction(action);  
    },
     setMaxValueOfReminderDate : function(component, event, helper) {
        var DueDate = event.getSource().get("v.value");
         component.find("ReminderDate").set("v.value",'');
         if(DueDate != null && DueDate != ''){ 
             alert("disabled");
          component.find("ReminderDate").set("v.disabled",false);  
          component.find("ReminderDate").set("v.max",DueDate);
         }
         else{
             component.find("ReminderDate").set("v.disabled",true);
         }
    }
})