doInit : function(component, event, helper) {
               {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();
            console.log("Failed with state: " + state);
  • I am getting Parsing error: Unexpected token { at line 10 (i.e. action.setCallback(this, funtion(response){ ) Can someone suggest me the what is require in this? Nov 14 '18 at 18:12

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) {....});
  • 1
    +1 Good catch; I didn't copy-paste into a syntax highlighter, so I missed that one.
    – sfdcfox
    Nov 14 '18 at 18:19
  • 1
    Very easy to miss for sure. I actually copied the snippet and was trying in dev console and was able to find it out on process of elimination only after I copy pasted another snippet on that line to be able to pin-point :). Interestingly, component.set as in its current form in the question just saves fine.
    – Jayant Das
    Nov 14 '18 at 18:21
  • 1
    trying on dev console, +1 for this effort Nov 14 '18 at 20:48
  • @PranayJaiswal - that's the only separate chrome window that is always open on my workstation :P
    – Jayant Das
    Nov 14 '18 at 20:50

The compiler usually tells you what line the error is on, but it happens you have some typos on line 3; it's likely they weren't detected until everything got out of sync several lines later in this case.

The function signature should be:

component.set(string, object);

But you've written:


This is simply invalid syntax in the long run.

The corrected version is:

    component.set("v.columns", [

Where the first parameter is almost always a string (rarely, a parameter when called from another function), and the missing comma is necessary to split the first and second parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.