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.



12 comments:

  1. Hi I have written the Odata action the static one on the data entitiy .How could make a call to this in my Odataclinet

    ReplyDelete
    Replies
    1. Can you please let me know some more details so that I can understand your query better.
      Where are you trying to call? From visual studio?

      Delete
  2. Hi,
    What are the restrictions for the parameters that an odata action can take? I read that it only takes base types such as int/str/real/boolean, and not able to take in an array. Can you confirm?
    THanks

    ReplyDelete
  3. Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!! resource at slickcashloan

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Wow, excellent post. I'd like to draft like this too - taking time and real hard work to make a great article. This post has encouraged me to write some posts that I am going to write soon. best-laptop-for-medical-billing-and-coding

    ReplyDelete
  6. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.
    try these guys

    ReplyDelete
  7. I think this option is no more in D365. Past 2days I am trying but of no use. Only it accepts enum parameters

    ReplyDelete
  8. Thanks for sharing this. Its difficult to get such resourceful manuals for D365. Test automation is a method in software testing that makes use of special software tools to control the execution of tests, or to automate a manual testing processes for easy and repetitive action without any human intervention, and then compares actual test results with predicted or expected results.

    Automating the end-to-end test of the Dynamics 365 sales and operations integration is highly beneficial to organisations because they can now this test on a regular basis with no additional costs. These regression tests can now be executed whenever there is a change/update/new development made either by Microsoft or by the user system. This will maximise test coverage for the organisation without the related efforts and costs and will give users additional confidence in the system before each release.

    ReplyDelete
  9. Great article! Dynamics 365 Finance and Operations pricing UAE is undoubtedly an essential tool for businesses in the UAE. The pricing details are crucial for organizations looking to make an informed decision. As a Microsoft partner in the UAE, we have helped numerous businesses implement this powerful solution, and we can vouch for its effectiveness in streamlining financial processes, improving decision-making, and enhancing overall efficiency.

    ReplyDelete

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, ...