Using OData bound actions
We can use Dynamics 365 Business Central APIs not only to perform CRUD operations on an entity but also to invoke standard business logic defined in the application (both custom and standard code).
We can trigger Dynamics 365 Business Central business logic associated with the current entity via APIs by using OData bound actions. Bound actions are essentially actions that you can invoke via HTTP calls for a selected entity.
Imagine that you want to have an API action to clone a selected customer. This action takes the context of the selected customer and then it creates a new customer record with the same field values (except the Name
field).
To do that, we can add a bound action to the previously created Customer
API.
To use OData V4 bound actions, you need to declare a procedure in the API page decored with the [ServiceEnabled]
attribute. The procedure is defined as follows:
[ServiceEnabled]
procedure Clone (var ActionContext...