April 2, 2020

Something has gone wrong. Cannot read property 'get' of undefined

Make sure get() in the JAVASCRIPT doesn't having undefined value. Check the condition before using get().

Sample Code:

var contractNo = component.find("contractNo");
var contractNoValue = contractNo.get("v.value")

In the above code, there should be a component with id "contractNo", else we will get this error.

2 comments:

  1. I have mentioned everything correct, but still i am facing the issue, may i know if there are any trouble shooting points.

    Code: Component:







    js controller: var selectedSOrg = component.find("selctOrg").get("v.value");


    Error is: [Cannot read property 'get' of undefined]

    ReplyDelete
    Replies
    1. I think the issue is with component.find("selctOrg").
      The component is not found.

      Delete