gymcode
gymcode

Reputation: 4623

Javascript ReferenceError: Value is not defined

My following function encountered the following error when triggered in Dynamics form.

ReferenceError: heightStart is not defined

function Start(type) {
    debugger;
    alert("Start | type: " + type);
    if (type == "heightStart") {
        var height = Xrm.Page.getAttribute("ccc_heightincmstart").getValue();
        if (height != null && height != "") {
            GetChildInfo(height, type);
        }
        else {
            Xrm.Page.getAttribute("ccc_heightpercentilestart").setValue("");
        }
    }
}

May I know how can I fix this error?

type is a value passed in with Web Resource File Handler mapping. enter image description here

Upvotes: 0

Views: 930

Answers (3)

PhuocLe
PhuocLe

Reputation: 131

because you pass the executioncontext so the function should be

function(executioncontext, type) ....

Upvotes: 0

You have to pass parameter with double quotes like “heightStart”

enter image description here

Read more

Upvotes: 1

Brendan C.
Brendan C.

Reputation: 171

It appears that the Parameter form is interpreting heightStart as a variable. Try wrapping it in quotes in the form; "heightStart"

Upvotes: 1

Related Questions