Showing posts with label Calling Odata actions in Dynamics 365. Show all posts
Showing posts with label Calling Odata actions in Dynamics 365. Show all posts

Thursday, May 3, 2018

Testing Odata actions in Dynamics 365

With new Odata actions, we can now expose any custom business logic from D365, without having to create an custom service.
Apart from using the data entities for data integrations, we can also create and expose the methods too, as Odata actions.They can be used for the process integrations.

For example, using a SalesTable entity to create an Odata action to confirm or invoice the sales order.

Here is the simple example on testing the Odata actions in D365, using a tool called 'Postman'.

For the basic setup and for authentication the below url can be followed:


In this example, I have created a new static method for my custom entity.
The only new thing is, it has been decorated with [SysODataActionAttribute]



This method will invoice the sales order id that has been passed as the argument.
[Your organization's root URL]/data/[Your data entity]/Microsoft.Dynamics.DataEntities.['Method name']

For passing the parameter for the method, we can use the body section:


On clicking the 'Send' button for the POST request, the called method will be executed.

We can go back to D365FO to check if this succeed.
Below is the screenshot, where the mentioned sales order has been invoiced.



So, with this way we can create and expose the custom methods as Odata actions.
The example is for static method, but you can also try with the instance method for the data entity.



Quick & Easy way to create XSD from Dynamics 365 for finance and operations

If you are looking for an quick & easy way to create XSD (schema) from Dynamics 365 for finance and operations. Below is the way, ...