Calling a Power Platform AI Builder Model via oData

   Words by Paul McQuillan

   on 28/04/2021 21:00:00

We’ve got our Model setup in the Power Platform AI Builder and we’ve experimented with a Flow in Power Automate to query the Model and Predict an outcome.

As a next step we might want to start querying our model outside of Power Automate to start running experiments or test scenarios past our model – particularly if we want to start visualising the model graphically or showing ‘what-if’ style predictions.

We could run different Predict Actions in Power Automate in bulk to generate data from our model – but this would be quite wasteful.

Instead we might want to invoke our Model in real-time to generate a Prediction Outcome.

We can do this by invoking our Model via the Dynamics oData API.

This can be done by calling the Predict Action against our Model, and supplying our input values to generate the prediction.

The documentation from Microsoft for this call is fairly non-existent as yet so this took some trial and error to get right – but it can be done.

Specifically by calling the following command as a REST Endpoint using a POST Message:

https://[mycrm].crm[region][GUID Id of my Model])/Microsoft.Dynamics.CRM.Predict

Supplying the details of our Prediction Input as the Body of the Message:

  "version": "2.0",
  "requestv2": {
    "@odata.type": "Microsoft.Dynamics.CRM.opportunity",
    "new_winnability": 100

This tests the model to return the Predicted Outcome when a single Input is supplied – in my case, just [Winnability] as 100.

The Model will then return its prediction for that scenario:



  "@odata.type": "#Microsoft.Dynamics.CRM.expando",

  "operationStatus": "Success",


    "@odata.type": "#Microsoft.Dynamics.CRM.expando",

    "Explanation": "[{\"entityName\": \"new_projects\", \"attributeName\": \"new_projecttype\", \"weight\": 0.13992829903618048}, {\"entityName\": \"opportunity\", \"attributeName\": \"new_customercontractstatus\", \"weight\": 0.11845726947582477}, {\"entityName\": \"new_projects\", \"attributeName\": \"new_name\", \"weight\": 0.05761718620521564}]",

    "Likelihood": 0.6319,

    "Prediction": 2




This then provides a way of querying our model using Custom Development or JSON Calls outside of Power Automate.

By building a series of JSON Calls, we could use this approach to build real-time scenarios comparing different probabilities for scenarios in the Model.

This can most obviously be seen using a JSON Client such as Talend to pass requests to our Model and evaluate the responses.


At the time of writing, I found the Microsoft Documentation on this action to be ‘evolving’ as took pulling a few resources on oData to get the syntax of this call right – so hopefully this article helps point in the right direction!

Further Reading

Predict Action

Predict Response

Getting Started with the Power Platform AI Builder

Share this Article

Search Articles

Filter Articles

CRM Tech DocMan

Recent Articles

HOW TO: Integrate SQL Users into Dataverse Teams HOW TO: Prepare to go LIVE on Linked-In! Creating a Homepage Canvas App HOW TO: Virtual Entities in Dynamics 365 Release Wave 2 New Feature: The Columns Button HOW TO: Search a date field in Microsoft Dynamics The Relevance Search COMING SOON to Power Apps Portals HOW TO: Manage Your Dynamics 365 Database Size (Video Included) Dynamics 365 Marketing vs ClickDimensions It’s time to pause, reflect and acknowledge a new era of inclusivity and collaboration. Part 2 - How to get the most from a Technology Expert – Asset Management Hub Property & Asset Management Hub Part 1 – Balancing CRM and Asset Management Scopes - Asset Management Hub Creating a Multi-Lingual PowerApps Portal How to Set Up a Microsoft Teams Site Using DocDrive365 Microsoft Teams - Adding a Microsoft Teams URL to a Dynamics Appointment Dynamics 365 Marketing – Customer Voice Survey Not Appearing In Emails? Using SQL Management Studio to connect to the Dynamics DB Calling a Power Platform AI Builder Model via oData How to use DocDrive365 to integrate permissions between Business Units in Dynamics with Sites in SharePoint Getting started with the Power Platform AI Builder. Power Apps Portal Information Hub DocDrive365 Security: Day One - Getting Started with Dynamics to SharePoint Permissions Part 5 - Power Apps Portals: How To Connect Azure B2C With Linked-In Part 4 – Power Apps Portals: Styling Azure B2C for Power Apps Portals
Contact Us

Want expert advice or a demo?

Get in touch now and see how we can help your business grow.

  • Name
  • Email Address
  • Phone Number

Understanding Your Challenges

Our strong understanding of CRM and emerging technologies within the Microsoft environment means we deliver the right solutions for you.

Proven Real-World Solutions

As a leader in the field of Dynamics solutions, our pedigree developing and delivering real-world solutions is unsurpassed.

Long Term Support

We provide support beyond our design, implementation and 'go-live' delivery using Sprints and continual updates to our AppSource apps.

CRMCS | Design by Thinktank Marketing | Citrus-Lime Limited

To improve your experience today and in the future, this site uses cookies. Read our full Privacy Policy & Cookie information here I Understand