RegressionSolutionVersion - Global

concept australia Updated Sep 10, 2026 7 min read RegressionSolutionVersionAPI.md
Raw file servicenow.com

The RegressionSolutionVersion API is a scriptable object used in Predictive Intelligence stores.

This API requires the Predictive Intelligence plugin (com.glide.platform_ml) and is provided within the sn_ml namespace.

Use this API when working with solution versions based on RegressionSolution API objects in the RegressionSolution store.

The system creates a solution version each time you train a solution definition. Most versions are created during scheduled solution training.

Methods in this API are accessible using the following RegressionSolution methods:

Parent Topic:Server API reference

RegressionSolutionVersion - getProperties()

Gets solution object properties and version number.

Name Type Description
None

Type

Description

Object

Contents of the Dataset and RegressionSolution version details. Results vary by object property setup.``` { "datasetProperties": {Object}, "domainName": "String", "encoder": {Object},
"inputFieldNames": [Array], "isActive": Boolean, "label": "String", "name": "String", "predictedFieldName": "String", "predictedInterval": [Array], "processingLanguage": "String", "scope": "String", "stopwords": [Array], "versionNumber": "Number" }

Text
</td></tr><tr><td>
&lt;Object&gt;.datasetProperties
</td><td>
Lists the properties of the [DatasetDefinition\(\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/DatasetDefinitionAPI.md) object associated with the solution.

{ "encodedQuery": "String", "fieldDetails": [Array], "fieldNames": [Array], "tableName": "String" }

Text
</td></tr><tr><td>
&lt;Object&gt;.datasetProperties.tableName
</td><td>
Name of the table for the dataset. For example, `"tableName" : "Incident"`. Data type: String.
</td></tr><tr><td>
&lt;Object&gt;.datasetProperties.fieldNames
</td><td>
List of field names from the specified table as strings. For example, `"fieldNames" : ["short_description", "priority"]`. Data type: Array.
</td></tr><tr><td>
&lt;Object&gt;.datasetProperties.fieldNames.fieldDetails
</td><td>
List of JavaScript objects that specify field properties. ```[  {    "name": "String",    "type": "String"  }]

Data type: Array.

<Object>.datasetProperties.fieldNames.fieldDetails.<object>.name

Name of the field defining the type of information to restrict this dataset to. Data type: String.

<Object>.datasetProperties.fieldDetails.<object>.type

Machine-learning field type. Data type: String.

<Object>.datasetProperties.fieldDetails.encodedQuery

Encoded query string in the standard platform format. See Encoded query strings.Data type: String.

<Object>.domainName

Domain name associated with this dataset. See Domain separation and Predictive Intelligence.Type: String

<Object>.encoder

Encoder object assigned to this solution. See Encoder - Encoder(Object config).Data type: Object.

<Object>.inputFieldNames

List of input field names as strings. The model uses these fields used to make predictions. Data type: String.

<Object>.isActive

Flag that indicates whether this version is active.Valid values:

  • true: Version is active.
  • false: Version is not active.

Data type: String

<Object>.label

Identifies the prediction task. ``` { "label": "my first prediction" }

Text
 Data type: String.
</td></tr><tr><td>
&lt;Object&gt;.name
</td><td>
System-assigned name. Data type: String.
</td></tr><tr><td>
&lt;Object&gt;.predictedFieldName
</td><td>
Identifies a field to be trained for predictability. Data type: String.
</td></tr><tr><td>
&lt;Object&gt;.predictedInterval
</td><td>
Range of values specifying the prediction confidence level.Data type: Array
</td></tr><tr><td>
&lt;Object&gt;.processingLanguage
</td><td>
Processing language in two-letter ISO 639-1 language code format. Data type: String.
</td></tr><tr><td>
&lt;Object&gt;.scope
</td><td>
Object scope. Currently the only valid value is `global`.Data type: String
</td></tr><tr><td>
&lt;Object&gt;.stopwords
</td><td>
Optional. Preset list of strings that the system automatically generates based on the **language** property setting. For details, see [Create a custom stopwords list](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/intelligent-experiences/create-custom-stopwords-list.md). Data type: Array.
</td></tr><tr><td>
&lt;Object&gt;.versionNumber
</td><td>
Version number of the RegressionSolution object.
</td></tr></tbody></table>The following example gets properties of the active object version in the store.

// Get properties var mlSolution = sn_ml.RegressionSolutionStore.get('ml_incident_categorization');

gs.print(JSON.stringify(JSON.parse(mlSolution.getActiveVersion().getProperties()), null, 2));

Text
Output:

{ "datasetProperties": { "encodedQuery": "", "fieldNames": [ "short_description", "sourcedc", "targetdc", "dbsize", "duration" ], "tableName": "cloudinfratext" }, "domainName": "global", "encoderProperties": { "datasetsProperties": [], "name": "wc_regression" }, "inputFieldNames": [ "short_description", "sourcedc", "targetdc", "dbsize" ], "isActive": "true", "label": "Regression Test for DB Restore", "name": "ml_x_snc_global_global_regression", "predictedFieldName": "duration", "processingLanguage": "en", "stopwords": [ "Default English Stopwords" ], "versionNumber": "1" }

Text
## RegressionSolutionVersion - getStatus\(Boolean includeDetails\)
Gets training completion status.
<table id="table_xfh_vbw_plb" class="parameters"><thead><tr><th>
Name
</th><th>
Type
</th><th>
Description
</th></tr></thead><tbody><tr><td>
includeDetails
</td><td>
Boolean
</td><td>
Flag that indicates whether to return status **details**.Valid values:
-   true: Return additional details.-   false: Don't return additional details.
Default: False
</td></tr></tbody></table><table id="table_yfh_vbw_plb" class="returns"><thead><tr><th>
Type
</th><th>
Description
</th></tr></thead><tbody><tr><td>
Object
</td><td>
JavaScript object containing training status information for a [RegressionSolution](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/RegressionSolutionAPI.md) object.```{  "state": "String",  "percentComplete": "Number as a String",  "hasJobEnded": "Boolean value as a String",  "details": {Object}}

<Object>.state

Training completion state. If the training job reaches a terminal state, the job does not leave that state. If the state is terminal, the hasJobEnded property is set to true.Possible values:

  • fetching_files_for_training
  • preparing_data
  • retry
  • solution_cancelled (terminal)
  • solution_complete(terminal)
  • solution_error (terminal)
  • solution_incomplete
  • training_request_received
  • training_request_timed_out (terminal)
  • training_solution
  • uploading_solution
  • waiting_for_training

Data type: String

<Object>.hasJobEnded

Flag that indicates whether training is complete.Valid values:

  • true: Training is complete.
  • false: Training is incomplete.

Data type: Boolean value as a String

<Object>.percentComplete

Training percent complete. If the completion percentage is less than 100, the job might be in a terminal state. For example, if training times out.Data type: Number as a String

Range: 0 thru 100

<Object>.details

Object containing a list of additional training details.Data type: Object

The following example shows a successful result with training complete.
JavaScript
// Get statusvar mlSolution = sn_ml.RegressionSolutionStore.get('ml_incident_categorization');
gs.print(JSON.stringify(JSON.parse(mlSolution.getActiveVersion().getStatus(true), null, 2)));

Output:

JavaScript
{ "state":"solution_complete", "percentComplete":"100", "hasJobEnded":"true", "details":{"stepLabel":"Solution Complete"} // This information is only returned if getStatus(true);}

The following example shows an unsuccessful result with training complete.

JavaScript
// Get statusvar solutionName = 'ml_x_snc_global_global_regression_solution';var mlSolution = sn_ml.RegressionSolutionStore.get(solutionName);var trainingStatus = mlSolution.getLatestVersion().getStatus();
gs.print(JSON.stringify(JSON.parse(trainingStatus), null, 2));

Output:

JSON
{ "state":"solution_error", "percentComplete":"100", "hasJobEnded":"true"}

RegressionSolutionVersion - getVersionNumber()

Gets the version number of a solution object.

Name Type Description
None
Type Description
String Version number.

The following example shows how to get a version number.

JavaScript
// Get version numbervar mlSolution = sn_ml.RegressionSolutionStore.get('ml_incident_categorization');
gs.print("Version number: "+JSON.stringify(JSON.parse(mlSolution.getActiveVersion().getVersionNumber()), null, 2));

Output:

Text
Version number: 1

RegressionSolutionVersion - predict(Object input, Object options)

Gets the input data for a prediction.

Name

Type

Description

input

Object

GlideRecord or array of JSON objects containing field names and values as key-value pairs.

options

Object

Optional values for filtering prediction results.``` { "apply_threshold": Boolean, "top_n": Number }

Text
</td></tr><tr><td>
options.apply\_threshold
</td><td>
Boolean
</td><td>
Flag that indicates whether to check the threshold value for the solution and apply it to the result set.Valid values:
-   true: Return results in which confidence is greater than threshold.-   false: Return all results.
Default: True
</td></tr><tr><td>
options.top\_n
</td><td>
Number
</td><td>
If provided, returns the top results, up to the specified number of predictions.
</td></tr></tbody></table><table id="table_xwz_pbw_plb" class="returns"><thead><tr><th>
Type
</th><th>
Description
</th></tr></thead><tbody><tr><td>
Object
</td><td>
JSON object containing the prediction results sorted by sys\_id or record\_number. ```{    <identifier>: [Array]}

<Object>.<identifier>

List of objects with details for each prediction result.Data type: Array of Objects

XML
<identifier>: [  {    "confidence": Number,    "predictedSysId": "String",    "predictedValue": "String",     "threshold": Number  }]

<Object>.<identifier>.<object>.confidence

Value of the confidence associated with the prediction. For example, 53.84. Data type: Number

<Object>.<identifier>.<object>.predictedSysId

The sys_id of the predicted value. Results can be from any table on which information is being predicted. Data type: String

<Object>.<identifier>.<object>.predictedValue

Value representing the prediction result. Data type: String

<Object>.<identifier>.<object>.threshold

Value of the configured threshold associated with the prediction. Data type: Number

The following example shows how to display prediction results for a predict\(\) method that takes a GlideRecord by sys\_id for input and includes optional parameters to restrict to top three results and exclude the threshold value.
JavaScript
var mlSolution = sn_ml.RegressionSolutionStore.get('ml_incident_categorization');
// single GlideRecord inputvar input = new GlideRecord("incident");input.get("<sys_id>");
// configure optional parametersvar options = {};options.top_n = 3;options.apply_threshold = false;
var results = mlSolution.getVersion(1).predict(input, options);// pretty print JSON resultsgs.print(JSON.stringify(JSON.parse(results), null, 2));
JSON
{        "<sys_id/now_GR>": [    {      "confidence": 62.10782320780268,      "threshold": 20.36,      "predictedValue": "Clone Issues",      "predictedSysId": ""    },    {      "confidence": 6.945237375770391,      "threshold": 16.63,      "predictedValue": "Instance Administration",      "predictedSysId": ""    },    {      "confidence": 5.321061076300759,      "threshold": 23.7,      "predictedValue": "Administration",      "predictedSysId": ""    }  ]}

The following example shows how to display prediction results for a predict() method that takes an array of field names as key-value pairs for input and includes optional parameters to restrict to top three results and exclude the threshold value.

JavaScript
var mlSolution = sn_ml.RegressionSolutionStore.get('ml_incident_categorization');// key-value pairs inputvar input = [{"short_description":"my email is not working"}, {short_description:"need help with password"}];// configure optional parametersvar options = {};options.top_n = 3;options.apply_threshold = false;var results = mlSolution.predict(input, options);// pretty print JSON resultsgs.print(JSON.stringify(JSON.parse(results), null, 2));
JSON
{  "1": [    {      "confidence": 37.5023032262591,      "threshold": 10.72,      "predictedValue": "Authentication",      "predictedSysId": ""    },    {      "confidence": 24.439964862166583,      "threshold": 23.7,      "predictedValue": "Administration",      "predictedSysId": ""    },    {      "confidence": 11.736320486031047,      "threshold": 100,      "predictedValue": "Security",      "predictedSysId": ""    }  ],  "2": [    {      "confidence": 99,      "threshold": 17.77,      "predictedValue": "Email",      "predictedSysId": ""    },    {      "confidence": 3.182137005157543,      "threshold": 10.72,      "predictedValue": "Authentication",      "predictedSysId": ""    },    {      "confidence": 2.8773826570713514,      "threshold": -1,      "predictedValue": "Email (I/f)",      "predictedSysId": ""    }  ]}
Search documentation
Search document titles and file paths on the australia branch