You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.



call(name, parameters...)

Calls the SchemaMethod with the given name and returns the result. This method can be used to execute schema methods which are not associated with a type (so-called global schema methods).

  • Useful in situations where different types have the same or similar functionality but no common base class so the method can not be attached there
  • This method is particularly helpful in situations where one wants to create new instances of a type (because creating objects of type X is forbidden in custom methods on objects of type X)


Calling the method methodName

${call('methodName', 'param1', 'value1', 'param2', 'value2')}

Code example of methodName

log('methodName called - Parameters are: ', retrieve('param1'), retrieve('param2'))


  • global schema methods are always run in a superuser context
  • There are two reserved names for these methods: onStructrLogin and onStructrLogout. If these methods exists, they will be called when a user logs in or out respectively. For these two methods Structr will provide the current user in a variable called user.
  • Prior to this commit (Dec, 11th 2016) the parameters were passed numerically indexed instead of named. This meant that the above code example would have read log('methodName called - Parameters are: ', retrieve('1'), retrieve('3')) because the parameter names were also passed into the method.

Search results for "call()"


Calls the SchemaMethod with the given name and returns the result. This method is used to execute global schema methods (methods that are not associated with a type).

call(name [, key1, value1 [, ... ]] )
$.call(name [, map])

Business Logic

The third option to implement logic is to use a global schema method, especially when the logic is not bound to a specific type. Global schema methods can be called via REST using a special maintenance endpoint, scheduled for execution with a cron-like syntax or called from any scripting envrionment using the call() or call_privileged() functions.


In any other than the JavaScript context, you are required to use get() and call() to access built-in functions and constants. This results in code like the following example.