The method call actions allow you to call methods 'controller' with a specific signature or any other method with arbitrary parameters (Standard Methods).
Here is the method signature 'controller':
public void my_method(ActionRequest request, ActionResponse response)
And here is the definition of an action for calling this method:
<action-method name="action-sale-order-confirm">
<call class="com.axelor.sale.web.SaleOrderController" method="onConfirm"/>
</action-method>
There are actions that require a specific method. The result of the method can be assigned to any field. Suppose there is a method like this:
public class Hello {
...
public String say(String what) {
return "About: " + what;
}
}
We can call this method with the action-method like this:
<action-method name="act-contact-say">
<call class="com.axelor.contact.web.Hello" method="say(fullName)"/>
</action-method>
The format method is simply the standard Java syntax, such as:
my_method(arg1, arg2, "some-constant", 1222)
The arg1 and arg2 are assumed to come from the context, while the other two values are constants.
For example:
<action-record name="action-contact-defaults" model="com.axelor.contact.db.Contact">
...
<field name="firstName" expr="John"/>
<field name="lastName" expr="Smith"/>
....
<field name="notes" expr="action:act-contact-say"/>
</action-record>
or else
<action-record name="action-contact-defaults" model="com.axelor.contact.db.Contact">
...
<field name="firstName" expr="John"/>
<field name="lastName" expr="Smith"/>
....
<field name="notes" expr="call:com.axelor.contact.web.Hello:say(fullName)"/>
</action-record>
The result will be assigned to the field "notes."
Signing a standard method can be arbitrary in the parameters, however it should return an object of type ActionResponse or Map for the response to be correctly interpreted by the web client.