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:
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:
{
“responsev2”:{
“@odata.type”: “#Microsoft.Dynamics.CRM.expando”,
“operationStatus”: “Success”,
“predictionOutput”:{
“@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
https://www.crmcs.co.uk/content/getting-started-with-the-power-platform-ai-builder.aspx
