Modifier

Partager via


InvokeExtensibilityMethod method

Invokes an AL trigger on the Dynamics 365 Business Central service on the page that contains the control add-in. For more information, see Control add-in object.

For information about best practices on making control add-ins performant, see Control add-in best practices.

Method signature

void Microsoft.Dynamics.NAV.InvokeExtensibilityMethod(name, arguments, skipIfBusy, successCallback, errorCallback)

Parameters

Parameter Description
name Type: String

A string that contains the name of the AL trigger to invoke. This must be the name of the specified event using the [ApplicationVisible] attribute that defines the control add-in.
arguments Type: Array

An array that contains the arguments to pass to the AL trigger. Note that the arguments must be supplied in an array even when the trigger only takes one argument.
skipIfBusy Type: Boolean

A value to indicate whether to invoke the extensibility method if the client is busy. This parameter is optional and the default value is false.
successCallback Type: function

A function that is called when the extensibility method has finished execution on the server. This parameter is optional.

Function Syntax

The syntax of the function is the following:

function successCallback()
errorCallback Type: function

A function that is called when the extensibility method could not be executed on the server. This parameter is optional.

Function Syntax

The syntax of the function is the following:

function errorCallback()

Important

The callback functions are useful for synchronizing multiple calls to the server. This is used, for example, when transferring multiple data blocks to the server to prevent overflowing the communication channel between the client and the server.

skipIfBusy options

The following table illustrates the different settings of skipIfBusy combined with the client’s status.

skipIfBusy set to Client is busy Action
false false Method call invoked.
false true Method call is queued and will be invoked once the client is no longer busy.
true false Method call invoked.
true true No method call. The errorCallback is invoked instead.
var map = new VEMap('controlAddIn');  
map.onLoadMap = function () {  
    var arguments = [map.GetCenter()];  
    Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('MapLoaded', arguments);  
};  
map.LoadMap(...);  

See also

AL method reference
GetEnvironment method
GetImageResource method
OpenWindow method
Asynchronous considerations