getModel error message [ColdBox 3.5.0]

I am getting error message when trying to submit the form

Application Execution ExceptionError Type: Expression : [N/A]

Error Messages: Variable GETMODEL is undefined.

the error message pointing to the function line

var check= getModel(“testGateway”).checkHistory(test1= 1,test2= 2,ID= 3);

You need a form that is submittable.


Here we go again! :slight_smile:

Erik, you have a reputation of making it very difficult to help you. You didn’t tell us where that line of code exists. Is it in a handler?

Jason Durham

Sorry, the line of code located in the model file

If the getModel() call is inside an extended Virtual Entity Service or the like, you should inject it with

property name=“testGateway” inject=“model”;

(Note, if its in an ORM/Hibernate Entity, you should append persistent=“false” to that, regardless, don’t exactly recommend this route)

Unless I’m wrong, someone please correct me - I’ve often come across this, where getModel isn’t available in model services, so inject it instead?