Solution Model newGlobalMethod is deprecated

In the Servoy Wiki:

https://wiki.servoy.com/display/DOCS/So … del-Create

it gives this example:

var globalMethod = solutionModel.newGlobalMethod(‘function myGlobalMethod() { currentcontroller.newRecord(); }’);

But in Version: 8.4.0.3402 the newGlobalMethod is shown as deprecated.

What should be used instead?

thanks,

Terry

You should also specify the name of the global scope in which the method should be added:

var globalMethod = solutionModel.newGlobalMethod('yourScope', 'function myGlobalMethod() { currentcontroller.newRecord(); }');

If you don’t specify a scope name, the method is added in the “globals” scope, but using that scope is discouraged, because those methods can be called using a deeplink which might be a security risk.

Also: When pressing when hovering a deprecated method, you’ll get a tooltip with an @deprecated tag explaining what to use instead:
[attachment=0]screenshot_deprecated.png[/attachment]

Note that using currentcontroller is also deprecated :)

Thanks Joas.

Very helpful!

Terry