Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Predictive intelligence on client side not populating prediction results table?

Liyakhat
Mega Sage

Hi

 

I tried to run Predictions on client side and was successfull following below article

https://www.servicenow.com/community/ai-intelligence-articles/in-predictive-intelligence-how-to-get-...

But i observed its not populating prediction results table to view in reports

Any possible way to populate the table prediction results using client side predictions

@Pradyumna Das @Brian Bakker 

1 ACCEPTED SOLUTION

Brian Bakker
ServiceNow Employee
ServiceNow Employee

@Liyakhat  
You should use the applyPrediction method to populate the Prediction Results table. Here is an example -

 

var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_incident_categorization");
var inputGR = new GlideRecord("incident");
inputGR.get("0ef47232db801300864adfea5e961912");
mlSolution.applyPrediction(inputGR);  

Regards,

Brian

View solution in original post

5 REPLIES 5

Brian Bakker
ServiceNow Employee
ServiceNow Employee

@Liyakhat  
You should use the applyPrediction method to populate the Prediction Results table. Here is an example -

 

var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_incident_categorization");
var inputGR = new GlideRecord("incident");
inputGR.get("0ef47232db801300864adfea5e961912");
mlSolution.applyPrediction(inputGR);  

Regards,

Brian

Thanks @Brian Bakker 

 

This shall be in the script include predictcustomutils ? from below article

https://www.servicenow.com/community/ai-intelligence-articles/in-predictive-intelligence-how-to-get-...

 

inputGR.get("0ef47232db801300864adfea5e961912");

here the sysid is of?

 

Thanks for your response

Thanks @Brian Bakker 

 

The above code shall be placed in scriptinclude which is called from client side?

inputGR.get("0ef47232db801300864adfea5e961912");

 can you help me with the sysId here related to? 

 

Thanks for responding:)

Brian Bakker
ServiceNow Employee
ServiceNow Employee

@Liyakhat  

If making predictions via a Script Include via the Client Side, I am assuming that the record already exists where you want to trigger the prediction on. The line for the prediction in the script include predictcustomutils is as follows -

 

 var results = mlSolution.getVersion(version).predict(input, options);

 

I think you replace the method as follows -

 

 var results = mlSolution.applyPrediction(input, options);

OR

var results = mlSolution.getVersion(version).applyPrediction(input, options);

 This should apply the prediction and add the entry in [ml_predictor_results] table.

 

Regards,

Brian