[SalesForce] Parsing error: Unexpected token in below code of in Lightining controller

({
    doInit : function(component, event, helper) {
        component.set(v.columns[
               {label: 'Department ID', fieldName: 'DepartmentID', type: 'Auto Number'},
               {label: 'Department Name', fieldName: 'Name', type: 'text'},
               {label: 'Department Manager', fieldName: 'DepartmentManager', type: 'text'},
               {label: 'Employee Count', fieldName: 'NoofEmployee', type: 'number'}
        ]);
        var action= component.get("c.getRecord");
        action.setCallback(this, funtion(response){
                          var state=response.getState();
        if(state==="SUCCESS"){
            component.set("v.dept",response.getReturnValue());
        }
        else{
            console.log("Failed with state: " + state);
        }
        });
        $A.enqueueAction(action);    
}
})

Best Answer

On top of what @sfdcfox has mentioned, your issue is on this line:

 action.setCallback(this, funtion(response){

You are missing a c in the word function. You need to have it as:

 action.setCallback(this, function(response) {....});
Related Topic