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

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

Updated URL for the PI Rest Message Documentation:

https://docs.servicenow.com/bundle/washingtondc-api-reference/page/integrate/inbound-rest/concept/ag...

 

Kind Regards,

 

Ashley

suryamol_s
Kilo Guru

Hi Wouter,

I have the same requirement. I need to show the prediction on change of short description field in Incident form in ITIL view and in Portal view. I have tried to create client script and script includes. But didnt get the solution.

Kindly help me.

Regards,

Surya 

Hello,

I have the same requirement for predictive intelligence. I am trying to populate assignment group based on change of short description. It works in a business rule. How do I do it on incident form using client script? 

Thanks