The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Business Rule syntax to call 3 predictive intelligence classification models on Incident table

AISHWARYAGM
Tera Contributor

I have 3 classification predictive intelligence models that predict category,subcategory and service type based on description and short description of a ticket. New tickets that come to incident table must be classified using these 3 models. How do I write a business rule for that. A syntax/sample format would be helpful to get started.

1 REPLY 1

Lener Pacania1
ServiceNow Employee
ServiceNow Employee

You will need to use the ML Solution API and call your classification solutions using the MLSolutionFactory.getSolution() function call.  Below is a code snippet that I ran in my instance.

 

var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_incident_assignment");

// key-value pairs input
var input = [{"short_description":"11g out of space"}, 
			{short_description:"outlook is not working"}];

// configure optional parameters
var options = {};
options.top_n = 3;
options.apply_threshold = false;

var results = mlSolution.predict(input, options);
// pretty print JSON results
gs.print(JSON.stringify(JSON.parse(results), null, 2));

 

Output:

*** Script: {
  "1": [
    {
      "confidence": 99,
      "threshold": 100,
      "predictedValue": "Database",
      "predictedSysId": "287ee6fea9fe198100ada7950d0b1b73"
    },
    {
      "confidence": 2.5961467611086864e-22,
      "threshold": 100,
      "predictedValue": "Hardware",
      "predictedSysId": "8a5055c9c61122780043563ef53438e3"
    },
    {
      "confidence": 3.638193954366966e-23,
      "threshold": 99.06,
      "predictedValue": "Software",
      "predictedSysId": "8a4dde73c6112278017a6a4baf547aa7"
    }
  ],
  "2": [
    {
      "confidence": 99,
      "threshold": 99.06,
      "predictedValue": "Software",
      "predictedSysId": "8a4dde73c6112278017a6a4baf547aa7"
    },
    {
      "confidence": 0.7543039973825216,
      "threshold": 100,
      "predictedValue": "Hardware",
      "predictedSysId": "8a5055c9c61122780043563ef53438e3"
    },
    {
      "confidence": 0.7186493836343288,
      "threshold": 100,
      "predictedValue": "Network",
      "predictedSysId": "287ebd7da9fe198100f92cc8d1d2154e"
    }
  ]
}

 

I have a VERY OLD example of the business rule here (bottom of article), the functions are deprecated so you will need to replace them with the new functions in the ML Solution API but at least it will give you a sense of the structure you will need.   An easier route is to use Task Intelligence .  We use the recommendation framework to either present or auto-populate the predictions, so there is no coding required.