Example of scripts for Similarity Solution Definition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 05:05 AM
I have a similarity solution developed on incident table with fields - short description , configuration item & service offering.
How to call the similarity api ?
Should I pass the display value or sys id for these fields in the api?
Any links or coding examples would be helpful.
- Labels:
-
Predictive Intelligence

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 07:43 AM
Please see the ML API documentation for code examples for any of the PI models. In the documentation you will see we use sys_id of the record that you want to compare (see below).
var mlSolution = sn_ml.SimilaritySolutionStore.get('ml_incident_categorization');
// single GlideRecord input
var input = new GlideRecord("incident");
input.get("<sys_id>");
// configure optional parameters
var options = {};
options.top_n = 3;
options.apply_threshold = false;
var results = mlSolution.getVersion(1).predict(input, options);
// pretty print JSON results
gs.print(JSON.stringify(JSON.parse(results), null, 2));
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2025 03:33 AM
I am also trying to use a Similarity Solution in a script.
var mlSolution = sn_ml.SimilaritySolutionStore.get('ml_incident_categorization');
This code returns the "Similarity" type solutions, but not the newer "Workflow Similarity" solutions. How can I make use of those solutions?