How to use Predictive Intelligence in client script?

wouter_de_waal
Tera Contributor

Predictive Intelligence normally runs after insert/update using business rules. We are bringing this forward to the Service Portal form or on the incident form using client scripts. We are using the MLPredictor API: 

var MLP = new MLPredictor();

var solution = MLP.findActiveSolution(solutionName);                            

var predictedOutcome = solution.predictText(solutionInput);                            

var outcome = predictedOutcome.predictedValue();                            

var confidence = predictedOutcome.confidence();  

This seems to be deprecated in Orlando and is not generating data for the prediction reports. 

Is there any API available that we can use to predict the value client side? 

1 ACCEPTED SOLUTION

sachin_namjoshi
Kilo Patron
Kilo Patron

You can call predictive intelligence REST API from server script of your service portal widget.

Check below for this REST API and it's usage

 

https://docs.servicenow.com/bundle/orlando-application-development/page/integrate/inbound-rest/conce...

 

Regards,

Sachin

View solution in original post

7 REPLIES 7

Greyson
Tera Contributor

Hello! 

Did you ever figure out how to do this?

 

Thank you for your help 🙂

We implemented a UI action and a script include from there, seems from client script we can't call

Harsha Pappala
Kilo Sage

Hi, @purelife , @suryamol_s ,

 

Did you get a solution for this ?

Would be grateful if you have any suggestions on this 

 

with regards

Harsha Pappala