---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# RegressionSolutionStore - Global

# RegressionSolutionStore - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

Enables storing and retrieving solutions.{#RegressionSolutionStoreAPI__mlstore-concept-sdesc-e}

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

## RegressionSolutionStore - add(Object mlSolution) {#ariaid-title2}

Adds a new solution object to the store and returns a unique name. {#RegressionStore-add_O__mlstore-add-sdesc-e}
Note:  
Label values do not need to be unique. For example, if you run this method with the same label 10 times, this method adds 10 different uniquely-named objects to the store.
{#RegressionStore-add_O__table_vwy_1fr_llb__entry__3}

| Name | Type | Description |
|-|-|-|
| mlSolution | [RegressionSolution](https://servicenow-prod.fluidtopics.net/3hYy9ifcFaLlyL23bPPuBg#RegressionSolutionAPI "The RegressionSolution API is a scriptable object used in Predictive Intelligence stores.") | [RegressionSolution()](https://servicenow-prod.fluidtopics.net/3hYy9ifcFaLlyL23bPPuBg#RegressionSol-RegressionSolution_O "Creates a regression solution.") object to add to the store. |
[Table 1. Parameters]

{#RegressionStore-add_O__table_vwy_1fr_llb} {#RegressionStore-add_O__table_wwy_1fr_llb__entry__2}

| Type | Description |
|-|-|
| String | System-generated solution name. |
[Table 2. Returns]

{#RegressionStore-add_O__table_wwy_1fr_llb}  
The following example shows how to add a solution to the store. Use [RegressionSolution - submitTrainingJob()](https://servicenow-prod.fluidtopics.net/3hYy9ifcFaLlyL23bPPuBg#RegressionSol-submitTrainingJob "Submits a training job.") to train the
Solution after adding it to the store.

    // Create a dataset 
    var myData = new sn_ml.DatasetDefinition({

      'tableName' : 'incident',
      'fieldNames' : ['assignment_group', 'short_description', 'description'],
      'encodedQuery' : 'activeANYTHING'

    });

    // Create an solution 
    var mySolution = new sn_ml.RegressionSolution({

      'label': "my solution definition",
      'dataset' : myData,
      'predictedFieldName' : 'assignment_group',
      'inputFieldNames':['short_description']

    });

    // Add the solution to the store to later be able to retrieve it.
    var my_unique_name = sn_ml.RegressionSolutionStore.add(mySolution);

## RegressionSolutionStore - deleteObject(String name) {#ariaid-title3}

Removes a specified solution object from the store.
{#RegressionStore-deleteObject_S__table_rmj_lfr_llb__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the [RegressionSolution()](https://servicenow-prod.fluidtopics.net/3hYy9ifcFaLlyL23bPPuBg#RegressionSol-RegressionSolution_O "Creates a regression solution.") object to be deleted. |
[Table 3. Parameters]

{#RegressionStore-deleteObject_S__table_rmj_lfr_llb} {#RegressionStore-deleteObject_S__table_smj_lfr_llb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 4. Returns]

{#RegressionStore-deleteObject_S__table_smj_lfr_llb}  
The following example shows how to delete a solution
from the store.

    sn_ml.RegressionSolutionStore.deleteObject("ml_sn_global_global_solution");

## RegressionSolutionStore - get(String name) {#ariaid-title4}

Gets a solution object from the store.
{#RegressionStore-get_S__table_zvw_v2r_llb__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of a solution in the store. |
[Table 5. Parameters]

{#RegressionStore-get_S__table_zvw_v2r_llb} {#RegressionStore-get_S__table_aww_v2r_llb__entry__2}

| Type | Description |
|-|-|
| Object | [RegressionSolution](https://servicenow-prod.fluidtopics.net/3hYy9ifcFaLlyL23bPPuBg#RegressionSolutionAPI "The RegressionSolution API is a scriptable object used in Predictive Intelligence stores.") object. Returns an error if the object does not exist. |
[Table 6. Returns]

{#RegressionStore-get_S__table_aww_v2r_llb}  
The following example shows how to get a solution object from the store using the get() method and view its training status using the
[RegressionSolution - getActiveVersion()](https://servicenow-prod.fluidtopics.net/3hYy9ifcFaLlyL23bPPuBg#RegressionSol-getActiveVersion "Gets the active RegressionSolutionVersion object.") and
[RegressionSolutionVersion - getStatus()](https://servicenow-prod.fluidtopics.net/2iYXU1mrDKRDWkn_fkHGMQ#RegressionVersion-getStatus_B "Gets training completion status.") methods.

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

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

Output:

    {
     "state":"solution_complete",
     "percentComplete":"100",
     "hasJobEnded":"true"
    }

## RegressionSolutionStore - getAllNames(Object options) {#ariaid-title5}

Gets the names of all solution definition records in the store.
{#RegressionStore-getAllNames__id_bfn_kwh_wnb__entry__3}

| Name | Type | Description |
|-|-|-|
| options | Object | Options for restricting results within the specified properties. { "label": "String", "domainName": "String", "scope": "String" }; |
| options.label | String | Optional. Label of your solution object. |
| options.domainName | String | Optional. Name of the domain for your solution object. Refer to [Domain separation and Predictive Intelligence](https://www.servicenow.com/docs/access?context=domain-separation-predictive-intelligence&version=xanadu&pubname=xanadu-intelligent-experiences&ft:locale=en-US). |
| options.scope | String | Optional. Name of an [application scope](https://www.servicenow.com/docs/access?context=c_ApplicationScope&version=xanadu&pubname=xanadu-application-development&ft:locale=en-US) for your solution object. |
[Table 7. Parameters]

{#RegressionStore-getAllNames__id_bfn_kwh_wnb} {#RegressionStore-getAllNames__table_aww_v2r_llb__entry__2}

| Type | Description |
|-|-|
| Array | List of strings representing solution object names in the store. |
[Table 8. Returns]

{#RegressionStore-getAllNames__table_aww_v2r_llb}  
In the following example, the
getAllNames() method returns a list of all names in the
store.

    gs.print(JSON.stringify(JSON.parse(sn_ml.RegressionSolutionStore.getAllNames()), null, 2));

Output:

    [
      "ml_x_snc_global_global_my_solution_definition_3",
      "ml_incident_assignment",
      "ml_x_snc_global_global_my_solution_definition",
      "ml_x_snc_global_global_my_solution_definition_2",
      "ml_sn_global_global_incident_service"
    ]

In the following example, the
getAllNames() method returns only names associated with
values set in the options parameter.

    var options = {
      'label' : 'my solution definition',
      'domainName' : 'global',
      'scope' : 'global'
    };
    var solNames = sn_ml.RegressionSolutionStore.getAllNames(options);
    gs.print(JSON.stringify(JSON.parse(solNames), null, 2));

Output:

    [
      "ml_x_snc_global_global_my_solution_definition"
    ]

## RegressionSolutionStore - update(String name, Object mlSolution) {#ariaid-title6}

Replaces an existing object in the store with the object passed as a parameter. The object name provided must be empty or match.
{#RegressionStore-update_S_O__table_v5p_wxr_llb__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the solution to update. |
| mlSolution | [RegressionSolution](https://servicenow-prod.fluidtopics.net/3hYy9ifcFaLlyL23bPPuBg#RegressionSolutionAPI "The RegressionSolution API is a scriptable object used in Predictive Intelligence stores.") | [RegressionSolution()](https://servicenow-prod.fluidtopics.net/3hYy9ifcFaLlyL23bPPuBg#RegressionSol-RegressionSolution_O "Creates a regression solution.") object properties to update. |
[Table 9. Parameters]

{#RegressionStore-update_S_O__table_v5p_wxr_llb} {#RegressionStore-update_S_O__table_w5p_wxr_llb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 10. Returns]

{#RegressionStore-update_S_O__table_w5p_wxr_llb}  
The following example shows how to update a solution
object in the store.

    var solutionUpdate = new sn_ml.RegressionSolution({
      'label': 'my solution definition',
      'dataset' : myData,
      'predictedFieldName' : 'assignment_group',
      'inputFieldNames': ['short_description']
    });

    sn_ml.RegressionSolutionStore.update('ml_sn_global_global_incident_service', solutionUpdate);


