# JSON to call function in class ReferenceError: "..." is undefined at Global code

**URL:** <https://discuss.jsonapi.org/t/json-to-call-function-in-class-referenceerror-is-undefined-at-global-code/1188>\
**Category:** Uncategorized\
**Created:** [January 19, 2018, 2:05pm UTC](https://discuss.jsonapi.org/t/json-to-call-function-in-class-referenceerror-is-undefined-at-global-code/1188 "2018-01-19T14:05:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![metalray](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@metalray](https://discuss.jsonapi.org/u/metalray)\
**Post date:** [January 19, 2018, 2:05pm UTC](https://discuss.jsonapi.org/t/json-to-call-function-in-class-referenceerror-is-undefined-at-global-code/1188/1 "2018-01-19T14:05:30Z")

</div>

Dear Java Script and JSON Experts,

I am using a third party BI Suite and need to use one of the classes  
to create a custom prompt button.  
However, my JS and JSON skills are…0

I must use JSON to call the function so this is how my JSON looks:

{  
“method”: “promptButtonFinish”,  
“sType”: “Finish”,  
“bEnabled”: “true”  
}

and that is the current error:

ReferenceError: “CPromptControl” is undefined at Global code

This is the constructor. Ultiately I want to call the method PromptButtonFinish()

//Constructor to create a button component  
// oParent: the button element  
// sType: the type of button (e.g. OK, Cancel, Back, Next, Finish, Reprompt)  
// bEnabled: the initial state of the button (true/false)  
function CPromptButton(oParent, iType, bEnabled, sCVId)  
{  
this.setCVId(sCVId);  
this.m\_oParent = oParent;  
this.m\_iType = iType;  
this.m\_bEnabled = bEnabled;  
this.draw();  
}

CPromptButton.prototype = new CPromptControl();

//run the report  
//method=forward  
//prevent further prompt pages  
function promptButtonFinish()  
{  
if ( f\_CSW\_tryCVPromptAction(‘finish’) )  
{  
return;  
}  
SetPromptContinue(‘false’);  
SetPromptMethod(K\_ACTION\_FORWARD);  
SetPromptControl(K\_ACTION\_PROMPT);  
}

Does someone know, what I can do to get my JSON to work?

---

<div class="post-metadata">

**Author:** ![michaelhibay](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/michaelhibay/32/405_2.png) [@michaelhibay](https://discuss.jsonapi.org/u/michaelhibay)\
**Post date:** [January 19, 2018, 2:50pm UTC](https://discuss.jsonapi.org/t/json-to-call-function-in-class-referenceerror-is-undefined-at-global-code/1188/2 "2018-01-19T14:50:48Z")

</div>

This forum is to discuss the {json:api} format, I think you would be better served asking on [www.stackoverflow.com](http://www.stackoverflow.com).

---

<div class="post-metadata">

**Author:** ![metalray](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@metalray](https://discuss.jsonapi.org/u/metalray)\
**Post date:** [January 19, 2018, 3:35pm UTC](https://discuss.jsonapi.org/t/json-to-call-function-in-class-referenceerror-is-undefined-at-global-code/1188/3 "2018-01-19T15:35:04Z")

</div>

Hi, OK. will do that. Thanks.

[https://stackoverflow.com/questions/48344579/jason-call-java-script-function-in-class](https://stackoverflow.com/questions/48344579/jason-call-java-script-function-in-class)

---

<div class="post-metadata">

**Author:** ![dgeb](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/dgeb/32/17_2.png) [@dgeb](https://discuss.jsonapi.org/u/dgeb)\
**Post date:** [January 25, 2018, 5:41pm UTC](https://discuss.jsonapi.org/t/json-to-call-function-in-class-referenceerror-is-undefined-at-global-code/1188/4 "2018-01-25T17:41:11Z")

</div>


