ChangeSuccess - Scoped
The ChangeSuccess script include provides methods that return the Performance Analytics (PA) success scores for change requests (original change success score based on group), change models, and change types.
This script include also provides helper methods that enable you to modify the return results of the getScoresForChange() method, which by default returns all three success scores. Using these helper methods, you can determine whether or not to return any of the success scores. You can also use these helper methods to provide return results with success score ratings or the PA indicators used to generate different types of scores for any method that returns a success score. In addition, you can request that the associated method bypass the access rights security check that is by default performed for each method.
You associate helper methods to a primary method using dot nomenclature such as the following:
new
sn_chg_score.ChangeSuccess().withTeamScore(false).withTypeScore(false).withSecurity(false).getScoresForChange(chgGr);
new
sn_chg_score.ChangeSuccess().withRatings().withIndicatorScores().getTeamScoreForGroupId("287ebd7da9fe198100f92cc8d1d2154e");
There are also methods that enable you to obtain the current values of specific Change Management system properties, such as com.snc.change_management.success_score.minimum_score, com.snc.change_management.success_score.maximum_score, and com.snc.change_management.success_score.entry_level_score. For a description of their functionality, see Change Management properties.
This API runs in the sn_chg_score namespace and the Change Management -
Change Success Score (com.snc.change_management.change_success_score) plugin must be
activated.
ChangeSuccess - getEntryLevelTeamScore()
Returns the value specified in the system property com.snc.change_management.success_score.entry_level_score.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Number | Current value of com.snc.change_management.success_score.entry_level_score. If this system property does not exist, the method uses a default value of 500 in the success score calculations. |
The following code example shows how to call this method.
gs.info(new sn_chg_score.ChangeSuccess().getEntryLevelTeamScore());
Return results:
500
ChangeSuccess - getMaximumPermittedTeamScore()
Returns the value specified in the system property com.snc.change_management.success_score.maximum_score.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | Current value of com.snc.change_management.success_score.maximum_score. If the system property does not exist, the method uses a default value of 850 in the success score calculations. |
This code example shows how to obtain the maximum permitted team score (com.snc.change_management.success_score.maximum_score) value.
gs.info(new sn_chg_score.ChangeSuccess().getMaximumPermittedTeamScore());
Return results:
850
ChangeSuccess - getMinimumPermittedTeamScore()
Returns the value specified in the system property com.snc.change_management.success_score.minimum_score.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | Current value of com.snc.change_management.success_score.minimum_score. If this system property does not exist, the method uses a default value of 0 in the success score calculations. |
The following code example shows how to call this method.
gs.info(new sn_chg_score.ChangeSuccess().getMinimumPermittedTeamScore());
Return results:
0
ChangeSuccess - getModelScoreForChange(Object chgGr)
Returns the latest model success score based on the specified change request GlideRecord.
| Name | Type | Description |
|---|---|---|
| chgGr | Object | Change request GlideRecord for which to return the model success score. |
| Element | Description |
|---|---|
| can_read | Flag that indicates whether a model success score could be retrieved for the specified change request. Possible values:
Data type: Boolean |
| chg_model | Individual objects for each field in the Change Model [chg_model] record referenced by the specified change request. Each object has a key that is the field name and contains value and
display_value properties. If the field type is date/time, then the method also returns a display_value_internal property which is in the user's timezone but in the system format YYYY-MM-DD
HH24:MM:SS.Data type: Object |
| chg_model.active | Flag that indicates whether the associated change model record is active and available within the instance. Possible values:
Data type: Object |
| chg_model.active.display_value | Display value for the active
flag. Data type: String |
| chg_model.active.value | Internal value for the active flag. Data type: Boolean |
| chg_model.advanced_security | Flag that indicates whether user criteria based security is being used in addition to role based security for this change model. Possible values:
Data type: Object |
| chg_model.advanced_security.display_value | Display value for the advanced_security flag. Data type: String |
| chg_model.advanced_security.value | Internal value for the advanced_security flag. Data type: Boolean |
| chg_model.available_in_ui | Flag that indicates whether the associated change model record is available within the user interface. Possible values:
Data type: Object |
| chg_model.available_in_ui.display_value | Display value for the available_in_ui flag. Data type: String |
| chg_model.available_in_ui.value | Value for the available_in_ui flag. Data type: Boolean |
| chg_model.color | Color of the associated change model on the change request landing page. Data type: Object |
| chg_model.color.display_value | Display value for color. Data type: String |
| chg_model.color.value | Internal value for color. Data type: String |
| chg_model.default_change_model | Flag that indicates whether the associated change model record is the default change model. Possible values:
Data type: Object |
| chg_model.default_change_model.display_value | Display value for the default change model flag. Data type: String |
| chg_model.default_change_model.value | Internal value for the default change model flag. Data type: Boolean |
| chg_model.description | Short description of the purpose of the change model. Data type: Object |
| chg_model.description.display_value | Display value for description. Data type: String |
| chg_model.description.value | Internal value for description. Data type: String |
| chg_model.implementation_states | List of sys_ids of states for which change requests using this model can be implemented. Data type: Object |
| chg_model.implementation_states.display_value | Display value for read_roles. Data type: String |
| chg_model.implementation_states.value | Internal value for read_roles. Data type: String |
| chg_model.name | Name of the change model. Data type: Object |
| chg_model.name.display_value | Display value for name. Data type: String |
| chg_model.name.value | Internal value for name. Data type: String |
| chg_model.read_roles | Security roles needed to read the change model record. Data type: Object |
| chg_model.read_roles.display_value | Display value for read_roles. Data type: String |
| chg_model.read_roles.value | Internal value for read_roles. Data type: String |
| chg_model.record_preset | Name-value pairs of the fields that should automatically be populated, with their associated values, when a new change request record is created. Values are separated by caret
symbols. For example:
Data type: Object |
| chg_model.record_preset.display_value | Display value for record_preset. Data type: String |
| chg_model.record_preset.value | Internal value for record_preset. Data type: String |
| chg_model.state_field | Choice list field from which to collect choices, based on the value provided in table_name. For change models, this is always set to "state". Data type: Object |
| chg_model.state_field.display_value | Display value for state_field. Data type: String |
| chg_model.state_field.value | Internal value for state_field. Data type: String |
| chg_model.sys_class_name | Change module table name. Always Change Model/chg_model. Data type: Object |
| chg_model.sys_class_name.display_value | Display value for sys_class_name. Data type: String |
| chg_model.sys_class_name.display_value | Internal value for sys_class_name. Data type: String |
| chg_model.sys_created_by | Name of the user that initially created the associated change module record. Data type: Object |
| chg_model.sys_created_by.display_value | Display value for sys_created_by. Data type: String |
| chg_model.sys_created_by.value | Internal value for sys_created_by. Data type: String |
| chg_model.sys_created_on | Date and time that the change module record was originally created. Data type: Object |
| chg_model.sys_created_on.display_value | Display value for sys_created_on. Data type: String |
| chg_model.sys_created_on.display_value_internal | Internal display value for sys_created_on. Data type: String |
| chg_model.sys_created_on.value | Internal value for sys_created_on. Data type: String |
| chg_model.sys_domain | If using domains in the instance, the name of the domain to which the change module record is associated. Data type: Object |
| chg_model.sys_domain.display_value | Display value for sys_domain. Data type: String |
| chg_model.sys_domain.value | Internal value for sys_domain. Data type: String |
| chg_model.sys_domain_path | If using domains in the instance, the domain path in which the associated change module record resides. Data type: Object |
| chg_model.sys_domain_path.display_value | Display value for sys_domain_path. Data type: String |
| chg_model.sys_domain_path.value | Internal value for sys_domain_path. Data type: String |
| chg_model.sys_id | Unique identifier of the associated change model record. Data type: Object |
| chg_model.sys_id.display_value | Display value for sys_id. Data type: String |
| chg_model.sys_id.value | Internal value for sys_id. Data type: String |
| chg_model.sys_mod_count | Number of times that the associated change model record has been modified. Data type: Object |
| chg_model.sys_mod_count.display_value | Display value for sys_mod_count. Data type: String |
| chg_model.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| chg_model.sys_name | Name of the change model. Always the same as the name parameter. Data type: Object |
| chg_model.sys_name.display_value | Display value for sys_name. Data type: String |
| chg_model.sys_name.value | Internal value for sys_name. Data type: String |
| chg_model.sys_tags | System tags associated with the change model record. Data type: Object |
| chg_model.sys_tags.display_value | Display value for sys_tags. Data type: String |
| chg_model.sys_tags.value | Internal value for sys_tags. Data type: String |
| chg_model.sys_updated_by | Name of the user that last updated the associated change model record. Data type: Object |
| chg_model.sys_updated_by.display_value | Display value for sys_updated_by. Data type: String |
| chg_model.sys_updated_by.value | Internal value for sys_updated_by. Data type: String |
| chg_model.sys_updated_on | Date and time the associated change model record was last updated. Data type: Object |
| chg_model.sys_updated_on.display_value | Display value for sys_updated_on. Data type: String |
| chg_model.sys_updated_on.display_value_internal | Internal display value for sys_updated_on. Data type: String |
| chg_model.sys_updated_on.value | Internal value for sys_updated_on. Data type: String |
| chg_model.table_name | Table that defines the Choice list field from which to collect choices. For change models this is always set to "change_request". Data type: Object |
| chg_model.table_name.display_value | Display value for table_name. Data type: String |
| chg_model.table_name.value | Internal value for table_name. Data type: String |
| chg_model.write_roles | Security roles needed to write to the change model record. Data type: Object |
| chg_model.write_roles.display_value | Display value for write_roles. Data type: String |
| chg_model.write_roles.value | Internal value for write_roles. Data type: String |
| score | Details about the returned score indicator. Data type: Object |
| score.delta | Change in the score from the previous score. Data type: Object |
| score.delta.display_value | Display value for delta. Data type: String |
| score.delta.value | Internal value for delta. Data type: String |
| score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| score.value | Value returned by PA for the success score. Data type: String |
This code example shows how to retrieve the latest model success score for the current change models GlideRecord, check if the user has read access to that change model, and if so, make an entry in the work notes if the success score value that is less than 50%.
var changeModelSuccess = new sn_chg_score.ChangeSuccess().getModelScoreForChange(current);
gs.info(JSON.stringify(changeModelSuccess,null,2));
if (changeModelSuccess.can_read && changeModelSuccess.score.has_score && changeModelSuccess.score.value < 50) {
chgGr.work_notes.setJournalEntry("The selected Change Model of \"" + changeModelSuccess.chg_model.name.display_value + "\" has a success rate of less than 50% (current success rate is: " + changeModelSuccess.score.display_value + "%).\nConsider using a different Model or adding additional approvers or discuss with your Change Manager.");
chgGr.update();
}
Example of the return results when calling this method:
{
"can_read": true,
"chg_model": {
"color": {
"display_value": "",
"value": ""
},
"default_change_model": {
"display_value": "false",
"value": false
},
"description": {
"display_value": "This model can be used to capture unauthorized change events that were detected.",
"value": "This model can be used to capture unauthorized change events that were detected."
},
"sys_updated_on": {
"display_value": "2020-10-21 11:10:57",
"value": "2020-10-21 10:10:57",
"display_value_internal": "2020-10-21 11:10:57"
},
"table_name": {
"display_value": "change_request",
"value": "change_request"
},
"sys_class_name": {
"display_value": "Change Model",
"value": "chg_model"
},
"sys_id": {
"display_value": "aedc6a625323101034d1ddeeff7b1296",
"value": "aedc6a625323101034d1ddeeff7b1296"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"write_roles": {
"display_value": "",
"value": ""
},
"sys_created_on": {
"display_value": "2020-10-02 14:50:20",
"value": "2020-10-02 13:50:20",
"display_value_internal": "2020-10-02 14:50:20"
},
"read_roles": {
"display_value": "itil,sn_change_read",
"value": "itil,sn_change_read"
},
"sys_name": {
"display_value": "Unauthorized Change",
"value": "Unauthorized Change"
},
"advanced_security": {
"display_value": "false",
"value": false
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
},
"record_preset": {
"display_value": "type=emergency^short_description=An unauthorized change has been detected^assignment_group=a715cd759f2002002920bde8132e7018^work_start=javascript:gs.nowDateTime()^unauthorized=true^EQ",
"value": "type=emergency^short_description=An unauthorized change has been detected^assignment_group=a715cd759f2002002920bde8132e7018^work_start=javascript:gs.nowDateTime()^unauthorized=true^EQ"
},
"sys_mod_count": {
"display_value": "9",
"value": 9
},
"active": {
"display_value": "true",
"value": true
},
"sys_tags": {
"display_value": "",
"value": ""
},
"available_in_ui": {
"display_value": "false",
"value": false
},
"state_field": {
"display_value": "state",
"value": "state"
},
"name": {
"display_value": "Unauthorized Change",
"value": "Unauthorized Change"
},
"implementation_states": {
"display_value": "",
"value": ""
}
},
"score": {
"indicator": {
"name": "Change Model: % Successful and Successful With Issues",
"sys_id": "604f98dfc302011005aea539e540dd75"
},
"value": 76.92307692307693,
"display_value": "76.92",
"delta": {
"value": "0",
"display_value": ""
},
"has_score": true
}
}
ChangeSuccess - getModelScoreForModelId(String sys_id, String domain_id)
Returns the latest model success score for the specified model sys_id.
| Name | Type | Description |
|---|---|---|
| sys_id | String | Sys_id of the group for which to return the model success score. Table: User Group [sys_user_group] |
| domain_id | String | Optional. Sys_id of a domain to use when querying Performance Analytics for the model success score. |
| Element | Description |
|---|---|
| can_read | Flag that indicates whether a model success score could be retrieved for the specified change request. Possible values:
Data type: Boolean |
| chg_model | Individual objects for each field in the Change Model [chg_model] record referenced by the specified change request. Each object has a key that is the field name and contains value and
display_value properties. If the field type is date/time, then the method also returns a display_value_internal property which is in the user's timezone but in the system format YYYY-MM-DD
HH24:MM:SS.Data type: Object |
| chg_model.active | Flag that indicates whether the associated change model record is active and available within the instance. Possible values:
Data type: Object |
| chg_model.active.display_value | Display value for the active
flag. Data type: String |
| chg_model.active.value | Internal value for the active flag. Data type: Boolean |
| chg_model.advanced_security | Flag that indicates whether user criteria based security is being used in addition to role based security for this change model. Possible values:
Data type: Object |
| chg_model.advanced_security.display_value | Display value for the advanced_security flag. Data type: String |
| chg_model.advanced_security.value | Internal value for the advanced_security flag. Data type: Boolean |
| chg_model.available_in_ui | Flag that indicates whether the associated change model record is available within the user interface. Possible values:
Data type: Object |
| chg_model.available_in_ui.display_value | Display value for the available_in_ui flag. Data type: String |
| chg_model.available_in_ui.value | Value for the available_in_ui flag. Data type: Boolean |
| chg_model.color | Color of the associated change model on the change request landing page. Data type: Object |
| chg_model.color.display_value | Display value for color. Data type: String |
| chg_model.color.value | Internal value for color. Data type: String |
| chg_model.default_change_model | Flag that indicates whether the associated change model record is the default change model. Possible values:
Data type: Object |
| chg_model.default_change_model.display_value | Display value for the default change model flag. Data type: String |
| chg_model.default_change_model.value | Internal value for the default change model flag. Data type: Boolean |
| chg_model.description | Short description of the purpose of the change model. Data type: Object |
| chg_model.description.display_value | Display value for description. Data type: String |
| chg_model.description.value | Internal value for description. Data type: String |
| chg_model.implementation_states | List of sys_ids of states for which change requests using this model can be implemented. Data type: Object |
| chg_model.implementation_states.display_value | Display value for read_roles. Data type: String |
| chg_model.implementation_states.value | Internal value for read_roles. Data type: String |
| chg_model.name | Name of the change model. Data type: Object |
| chg_model.name.display_value | Display value for name. Data type: String |
| chg_model.name.value | Internal value for name. Data type: String |
| chg_model.read_roles | Security roles needed to read the change model record. Data type: Object |
| chg_model.read_roles.display_value | Display value for read_roles. Data type: String |
| chg_model.read_roles.value | Internal value for read_roles. Data type: String |
| chg_model.record_preset | Name-value pairs of the fields that should automatically be populated, with their associated values, when a new change request record is created. Values are separated by caret
symbols. For example:
Data type: Object |
| chg_model.record_preset.display_value | Display value for record_preset. Data type: String |
| chg_model.record_preset.value | Internal value for record_preset. Data type: String |
| chg_model.state_field | Choice list field from which to collect choices, based on the value provided in table_name. For change models, this is always set to "state". Data type: Object |
| chg_model.state_field.display_value | Display value for state_field. Data type: String |
| chg_model.state_field.value | Internal value for state_field. Data type: String |
| chg_model.sys_class_name | Change module table name. Always Change Model/chg_model. Data type: Object |
| chg_model.sys_class_name.display_value | Display value for sys_class_name. Data type: String |
| chg_model.sys_class_name.display_value | Internal value for sys_class_name. Data type: String |
| chg_model.sys_created_by | Name of the user that initially created the associated change module record. Data type: Object |
| chg_model.sys_created_by.display_value | Display value for sys_created_by. Data type: String |
| chg_model.sys_created_by.value | Internal value for sys_created_by. Data type: String |
| chg_model.sys_created_on | Date and time that the change module record was originally created. Data type: Object |
| chg_model.sys_created_on.display_value | Display value for sys_created_on. Data type: String |
| chg_model.sys_created_on.display_value_internal | Internal display value for sys_created_on. Data type: String |
| chg_model.sys_created_on.value | Internal value for sys_created_on. Data type: String |
| chg_model.sys_domain | If using domains in the instance, the name of the domain to which the change module record is associated. Data type: Object |
| chg_model.sys_domain.display_value | Display value for sys_domain. Data type: String |
| chg_model.sys_domain.value | Internal value for sys_domain. Data type: String |
| chg_model.sys_domain_path | If using domains in the instance, the domain path in which the associated change module record resides. Data type: Object |
| chg_model.sys_domain_path.display_value | Display value for sys_domain_path. Data type: String |
| chg_model.sys_domain_path.value | Internal value for sys_domain_path. Data type: String |
| chg_model.sys_id | Unique identifier of the associated change model record. Data type: Object |
| chg_model.sys_id.display_value | Display value for sys_id. Data type: String |
| chg_model.sys_id.value | Internal value for sys_id. Data type: String |
| chg_model.sys_mod_count | Number of times that the associated change model record has been modified. Data type: Object |
| chg_model.sys_mod_count.display_value | Display value for sys_mod_count. Data type: String |
| chg_model.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| chg_model.sys_name | Name of the change model. Always the same as the name parameter. Data type: Object |
| chg_model.sys_name.display_value | Display value for sys_name. Data type: String |
| chg_model.sys_name.value | Internal value for sys_name. Data type: String |
| chg_model.sys_tags | System tags associated with the change model record. Data type: Object |
| chg_model.sys_tags.display_value | Display value for sys_tags. Data type: String |
| chg_model.sys_tags.value | Internal value for sys_tags. Data type: String |
| chg_model.sys_updated_by | Name of the user that last updated the associated change model record. Data type: Object |
| chg_model.sys_updated_by.display_value | Display value for sys_updated_by. Data type: String |
| chg_model.sys_updated_by.value | Internal value for sys_updated_by. Data type: String |
| chg_model.sys_updated_on | Date and time the associated change model record was last updated. Data type: Object |
| chg_model.sys_updated_on.display_value | Display value for sys_updated_on. Data type: String |
| chg_model.sys_updated_on.display_value_internal | Internal display value for sys_updated_on. Data type: String |
| chg_model.sys_updated_on.value | Internal value for sys_updated_on. Data type: String |
| chg_model.table_name | Table that defines the Choice list field from which to collect choices. For change models this is always set to "change_request". Data type: Object |
| chg_model.table_name.display_value | Display value for table_name. Data type: String |
| chg_model.table_name.value | Internal value for table_name. Data type: String |
| chg_model.write_roles | Security roles needed to write to the change model record. Data type: Object |
| chg_model.write_roles.display_value | Display value for write_roles. Data type: String |
| chg_model.write_roles.value | Internal value for write_roles. Data type: String |
| score | Details about the returned score indicator. Data type: Object |
| score.delta | Change in the score from the previous score. Data type: Object |
| score.delta.display_value | Display value for delta. Data type: String |
| score.delta.value | Internal value for delta. Data type: String |
| score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| score.value | Value returned by PA for the success score. Data type: String |
The following code example shows how to use the getTeamScoreForModelId()
method to retrieve the model scores for all active records for the associated change model,
filter through the requested records, and then places all model scores that are less than
65% and their associated deltas in the event queue
change_success.model.warning of the associated change model record.
var chgModelGr = new GlideRecord("chg_model");
chgModelGr.addActiveQuery();
chgModelGr.query();
while (chgModelGr.next()) {
var changeModelSuccess = new sn_chg_score.ChangeSuccess().getModelScoreForModelId(chgModelGr.getUniqueValue());
if (changeModelSuccess.can_read && changeModelSuccess.score.has_score && changeModelSuccess.score.value < 65)
gs.eventQueue("change_success.model.warning", chgModelGr, changeModelSuccess.score.value, changeModelSuccess.score.delta.value);
}
Output:
{
"can_read": true,
"chg_model": {
"color": {
"display_value": "",
"value": ""
},
"default_change_model": {
"display_value": "false",
"value": false
},
"description": {
"display_value": "This model can be used to capture unauthorized change events that were detected.",
"value": "This model can be used to capture unauthorized change events that were detected."
},
"sys_updated_on": {
"display_value": "2020-10-21 11:10:57",
"value": "2020-10-21 10:10:57",
"display_value_internal": "2020-10-21 11:10:57"
},
"table_name": {
"display_value": "change_request",
"value": "change_request"
},
"sys_class_name": {
"display_value": "Change Model",
"value": "chg_model"
},
"sys_id": {
"display_value": "aedc6a625323101034d1ddeeff7b1296",
"value": "aedc6a625323101034d1ddeeff7b1296"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"write_roles": {
"display_value": "",
"value": ""
},
"sys_created_on": {
"display_value": "2020-10-02 14:50:20",
"value": "2020-10-02 13:50:20",
"display_value_internal": "2020-10-02 14:50:20"
},
"read_roles": {
"display_value": "itil,sn_change_read",
"value": "itil,sn_change_read"
},
"sys_name": {
"display_value": "Unauthorized Change",
"value": "Unauthorized Change"
},
"advanced_security": {
"display_value": "false",
"value": false
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
},
"record_preset": {
"display_value": "type=emergency^short_description=An unauthorized change has been detected^assignment_group=a715cd759f2002002920bde8132e7018^work_start=javascript:gs.nowDateTime()^unauthorized=true^EQ",
"value": "type=emergency^short_description=An unauthorized change has been detected^assignment_group=a715cd759f2002002920bde8132e7018^work_start=javascript:gs.nowDateTime()^unauthorized=true^EQ"
},
"sys_mod_count": {
"display_value": "9",
"value": 9
},
"active": {
"display_value": "true",
"value": true
},
"sys_tags": {
"display_value": "",
"value": ""
},
"available_in_ui": {
"display_value": "false",
"value": false
},
"state_field": {
"display_value": "state",
"value": "state"
},
"name": {
"display_value": "Unauthorized Change",
"value": "Unauthorized Change"
},
"implementation_states": {
"display_value": "",
"value": ""
}
},
"score": {
"indicator": {
"name": "Change Model: % Successful and Successful With Issues",
"sys_id": "604f98dfc302011005aea539e540dd75"
},
"value": 76.92307692307693,
"display_value": "76.92",
"delta": {
"value": "0",
"display_value": ""
},
"has_score": true
}
}
ChangeSuccess - getScoresForChange(Object chgGr)
Returns the latest change team success score (original change success score based on group), model success score, and type success score based on the specified change request GlideRecord.
| Name | Type | Description |
|---|---|---|
| chgGr | Object | Change request GlideRecord. |
| Parameter | Description |
|---|---|
| model_success_score | Details on the model success score. Data type: Object |
| model_success_score.can_read | Flag that indicates whether a model success score could be retrieved for the specified change request. Possible values:
Data type: Boolean |
| model_success_score.chg_model | Individual objects for each field in the Change Model [chg_model] record referenced by the specified change request. Each object has a key that is the field name and contains value and
display_value properties. If the field type is date/time, then the method also returns a display_value_internal property which is in the user's timezone but in the system format YYYY-MM-DD
HH24:MM:SS.Data type: Object |
| model_success_score.chg_model.active | Flag that indicates whether the associated change model record is active and available within the instance. Possible values:
Data type: Object |
| model_success_score.chg_model.active.display_value | Display value for the active
flag. Data type: String |
| model_success_score.chg_model.active.value | Internal value for the active flag. Data type: Boolean |
| model_success_score.chg_model.advanced_security | Flag that indicates whether user criteria based security is being used in addition to role based security for this change model. Possible values:
Data type: Object |
| model_success_score.chg_model.advanced_security.display_value | Display value for the advanced_security flag. Data type: String |
| model_success_score.chg_model.advanced_security.value | Internal value for the advanced_security flag. Data type: Boolean |
| model_success_score.chg_model.available_in_ui | Flag that indicates whether the associated change model record is available within the user interface. Possible values:
Data type: Object |
| model_success_score.chg_model.available_in_ui.display_value | Display value for the available_in_ui flag. Data type: String |
| model_success_score.chg_model.available_in_ui.value | Value for the available_in_ui flag. Data type: Boolean |
| model_success_score.chg_model.color | Color of the associated change model on the change request landing page. Data type: Object |
| model_success_score.chg_model.color.display_value | Display value for color. Data type: String |
| model_success_score.chg_model.color.value | Internal value for color. Data type: String |
| model_success_score.chg_model.default_change_model | Flag that indicates whether the associated change model record is the default change model. Valid values:
Data type: Boolean Default: false |
| model_success_score.chg_model.default_change_model.display_value | Display value for the default change model flag. Data type: String |
| model_success_score.chg_model.default_change_model.value | Internal value for the default change model flag. Data type: Boolean |
| model_success_score.chg_model.description | Short description of the purpose of the change model. Data type: Object |
| model_success_score.chg_model.description.display_value | Display value for description. Data type: String |
| model_success_score.chg_model.description.value | Internal value for description. Data type: String |
| model_success_score.chg_model.implementation_states | List of sys_ids of states for which change requests using this model can be implemented. Data type: Object |
| model_success_score.chg_model.implementation_states.display_value | Display value for read_roles. Data type: String |
| model_success_score.chg_model.implementation_states.value | Internal value for read_roles. Data type: String |
| model_success_score.chg_model.name | Name of the change model. Data type: Object |
| model_success_score.chg_model.name.display_value | Display value for name. Data type: String |
| model_success_score.chg_model.name.value | Internal value for name. Data type: String |
| model_success_score.chg_model.read_roles | Security roles needed to read the change model record. Data type: Object |
| model_success_score.chg_model.read_roles.display_value | Display value for read_roles. Data type: String |
| model_success_score.chg_model.read_roles.value | Internal value for read_roles. Data type: String |
| model_success_score.chg_model.record_preset | Name-value pairs of the fields that should automatically be populated, with their associated values, when a new change request record is created. Values are separated by caret
symbols. For example:
Data type: Object |
| model_success_score.chg_model.record_preset.display_value | Display value for record_preset. Data type: String |
| model_success_score.chg_model.record_preset.value | Internal value for record_preset. Data type: String |
| model_success_score.chg_model.state_field | Choice list field from which to collect choices, based on the value provided in table_name. For change models, this is always set to "state". Data type: Object |
| model_success_score.chg_model.state_field.display_value | Display value for state_field. Data type: String |
| model_success_score.chg_model.state_field.value | Internal value for state_field. Data type: String |
| model_success_score.chg_model.sys_class_name | Change module table name. Always Change Model/chg_model. Data type: Object |
| model_success_score.chg_model.sys_class_name.display_value | Display value for sys_class_name. Data type: String |
| model_success_score.chg_model.sys_class_name.value | Internal value for sys_class_name. Data type: String |
| model_success_score.chg_model.sys_created_by | Name of the user that initially created the associated change module record. Data type: Object |
| model_success_score.chg_model.sys_created_by.display_value | Display value for sys_created_by. Data type: String |
| model_success_score.chg_model.sys_created_by.value | Internal value for sys_created_by. Data type: String |
| model_success_score.chg_model.sys_created_on | Date and time that the change module record was originally created. Data type: Object |
| model_success_score.chg_model.sys_created_on.display_value | Display value for sys_created_on. Data type: String |
| model_success_score.chg_model.sys_created_on.display_value.internal | Internal display value for sys_created_on. Data type: String |
| model_success_score.chg_model.sys_created_on.value | Internal value for sys_created_on. Data type: String |
| model_success_score.chg_model.sys_domain | If using domains in the instance, the name of the domain to which the change module record is associated. Data type: Object |
| model_success_score.chg_model.sys_domain.display_value | Display value for sys_domain. Data type: String |
| model_success_score.chg_model.sys_domain.value | Internal value for sys_domain. Data type: String |
| model_success_score.chg_model.sys_domain_path | If using domains in the instance, the domain path in which the associated change module record resides. Data type: Object |
| model_success_score.chg_model.sys_domain_path.display_value | Display value for sys_domain_path. Data type: String |
| model_success_score.chg_model.sys_domain_path.value | Internal value for sys_domain_path. Data type: String |
| model_success_score.chg_model.sys_id | Unique identifier of the associated change model record. Data type: Object |
| model_success_score.chg_model.sys_id.display_value | Display value for sys_id. Data type: String |
| model_success_score.chg_model.sys_id.value | Internal value for sys_id. Data type: String |
| model_success_score.chg_model.sys_mod_count | Number of times that the associated change model record has been modified. Data type: Object |
| model_success_score.chg_model.sys_mod_count.display_value | Display value for sys_mod_count. Data type: String |
| model_success_score.chg_model.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| model_success_score.chg_model.sys_name | Name of the change model. Always the same as the name parameter. Data type: Object |
| model_success_score.chg_model.sys_name | Display value for sys_name. Data type: String |
| model_success_score.chg_model.sys_name | Internal value for sys_name. Data type: String |
| model_success_score.chg_model.sys_tags | System tags associated with the change model record. Data type: Object |
| model_success_score.chg_model.sys_tags.display_value | Display value for sys_tags. Data type: String |
| model_success_score.chg_model.sys_tags.value | Internal value for sys_tags. Data type: String |
| model_success_score.chg_model.sys_updated_by | Name of the user that last updated the associated change model record. Data type: Object |
| model_success_score.chg_model.sys_updated_by.display_value | Display value for sys_updated_by. Data type: String |
| model_success_score.chg_model.sys_updated_by.value | Internal value for sys_updated_by. Data type: String |
| model_success_score.chg_model.sys_updated_on | Date and time the associated change model record was last updated. Data type: Object |
| model_success_score.chg_model.sys_updated_on.display_value | Display value for sys_updated_on. Data type: String |
| model_success_score.chg_model.sys_updated_on.display_internal_value | Internal display value for sys_updated_on. Data type: String |
| model_success_score.chg_model.sys_updated_on.value | Internal value for sys_updated_on. Data type: String |
| model_success_score.chg_model.table_name | Table that defines the Choice list field from which to collect choices. For change models this is always set to "change_request". Data type: Object |
| model_success_score.chg_model.table_name.display_value | Display value for table_name. Data type: String |
| model_success_score.chg_model.table_name.value | Internal value for table_name. Data type: String |
| model_success_score.score | Details about the returned score indicator. Data type: Object |
| model_success_score.score.delta | Change in the score from the previous score. Data type: Object |
| model_success_score.score.delta.display_value | Display value for delta. Data type: String |
| model_success_score.score.delta.value | Internal value for delta. Data type: String |
| model_success_score.score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| model_success_score.score.score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| model_success_score.score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| model_success_score.score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| model_success_score.score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| model_success_score.score.value | Value returned by PA for the success score. Data type: String |
| team_success_score | Details on the team success score. Data type: Object |
| team_success_score.can_read | Flag that indicates whether a change team success score could be retrieved for the specified change request. Possible values:
Data type: Boolean |
| team_success_score.chg_success_score_rating | Individual objects for each field from the Change Success Score Rating [chg_success_score_rating] record that matches the returned score. Each field object has a key that is
the field name and contains value and display_value properties. If the field type is date/time, then the method also returns a display_value_internal
property which is in the user's timezone but in the system format YYYY-MM-DD HH24:MM:SS. Data type: Object |
| team_success_score.chg_success_score_rating.active | Flag that indicates whether the associated change success score record is active and available within the instance. Possible values:
Data type: Object |
| team_success_score.chg_success_score_rating.active.display_value | Display value for the active
flag. Data type: String |
| team_success_score.chg_success_score_rating.active.value | Internal value for the active flag. Data type: Boolean |
| team_success_score.chg_success_score_rating.color | Color of the associated change success score as shown in the Change Success Score Card for a change request. Data type: Object |
| team_success_score.chg_success_score_rating.color.display_value | Display value for color. Data type: String |
| team_success_score.chg_success_score_rating.color.value | Internal value for color. Data type: String |
| team_success_score.chg_success_score_rating.rating | Change success score rating, such as Low or High. Data type: Object |
| team_success_score.chg_success_score_rating.rating.display_value | Display value for rating. Data type: String |
| team_success_score.chg_success_score_rating.rating.value | Internal value for rating. Data type: String |
| team_success_score.chg_success_score_rating.score_end | Highest value in the change success score. Data type: Object |
| team_success_score.chg_success_score_rating.score_end.display_value | Display value for score_end. Data type: String |
| team_success_score.chg_success_score_rating.score_end.value | Internal value for score_end. Data type: Number |
| team_success_score.chg_success_score_rating.score_start | Lowest value in the change success score. Data type: Object |
| team_success_score.chg_success_score_rating.score_start.display_value | Display value for
score_start. Data type: String |
| team_success_score.chg_success_score_rating.score_start.value | Internal value for score_start. Data type: Number |
| team_success_score.chg_success_score_rating.sys_class_name | Change Success Score Rating table name. Always Change Success Score Rating/chg_success_score_rating. Data type: Object |
| team_success_score.chg_success_score_rating.sys_class_name.display_value | Display value for
sys_class_name. Data type: String |
| team_success_score.chg_success_score_rating.sys_class_name.value | Internal value for
sys_class_name. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_by | Name of the user that initially created the associated change success score rating record. Data type: Object |
| team_success_score.chg_success_score_rating.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_on | Date and time that the change success score rating record was originally created. Data type: Object |
| team_success_score.chg_success_score_rating.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_on.display_internal.value | Internal display value
for sys_created_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_domain | If using domains in the instance, the name of the domain to which the change success score record is associated. Data type: Object |
| team_success_score.chg_success_score_rating.sys_domain.display_value | Display value for sys_domain. Data type: String |
| team_success_score.chg_success_score_rating.sys_domain.value | Internal value for sys_domain. Data type: String |
| team_success_score.chg_success_score_rating.sys_id | Unique identifier of the associated change success score record. Data type: Object |
| team_success_score.chg_success_score_rating.sys_id.display_value | Display value for the sys_id. Data type: String |
| team_success_score.chg_success_score_rating.sys_id.value | Internal value for the sys_id. Data type: String |
| team_success_score.chg_success_score_rating.sys_mod_count | Number of times that the associated change success score record has been modified. Data type: Object |
| team_success_score.chg_success_score_rating.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| team_success_score.chg_success_score_rating.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| team_success_score.chg_success_score_rating.sys_name | Name of the change success score rating. Possible values:
Data type: Object |
| team_success_score.chg_success_score_rating.sys_name.display_value | Display value for sys_name. Data type: String |
| team_success_score.chg_success_score_rating.sys_name.value | Internal value for sys_name. Data type: String |
| team_success_score.chg_success_score_rating.sys_overrides | Sys_id of a record in the same table but in a domain above that of the current record. This allows a record in a lower domain to override a record in a domain above it. For example, if you have a rating record defined in the "global" domain but for domain "TOP/ACME" you override the record in "global". Data type: Object |
| team_success_score.chg_success_score_rating.sys_overrides.display_value | Display value for
sys_overrides. Data type: String |
| team_success_score.chg_success_score_rating.sys_overrides.value | Internal value for sys_overrides. Data type: String |
| team_success_score.chg_success_score_rating.sys_tags | List of system tags associated with the change success score record. Data type: Object |
| team_success_score.chg_success_score_rating.sys_tags.display_value | Display value for sys_tags. Data type: String |
| team_success_score.chg_success_score_rating.sys_tags.value | Internal value for sys_tags. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_by | Name of the user that last updated the associated change success score record. Data type: Object |
| team_success_score.chg_success_score_rating.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_on | Date and time the associated change success score record was last updated. Data type: Object |
| team_success_score.chg_success_score_rating.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_on.display_internal_value | Internal display value
for sys_updated_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
| team_success_score.score | Details about the returned score indicator. Data type: Object |
| team_success_score.score.delta | Change in the score from the previous score. Data type: Object |
| team_success_score.score.delta.display_value | Display value for delta. Data type: String |
| team_success_score.score.delta.value | Internal value for delta. Data type: String |
| team_success_score.score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| team_success_score.score.score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| team_success_score.score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| team_success_score.score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| team_success_score.score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| team_success_score.score.value | Value returned by PA for the success score. Data type: String |
| team_success_score.sys_user_group | Individual objects for each field from the
Group [sys_user_group] record referenced by the specified change request. Each field
object has a key that is the field name and contains value and
display_value properties. If the field type is date/time,
then the method also returns a display_value_internal property
which is in the user's timezone but in the system format YYYY-MM-DD HH24:MM:SS. Data
type: Object |
| team_success_score.sys_user_group.active | Flag that indicates whether the group is active. Possible values:
Data type: Object |
| team_success_score.sys_user_group.active.display_value | Display value for the
active flag. Data type: String |
| team_success_score.sys_user_group.active.value | Internal value for the active
flag. Data type: Boolean |
| team_success_score.sys_user_group.cost_center | Sys_id of the cost center associated with the group. Data type: Object |
| team_success_score.sys_user_group.cost_center.display_value | Display value for
cost_center. Data type: String |
| team_success_score.sys_user_group.cost_center.value | Internal value for
cost_center. Data type: String |
| team_success_score.sys_user_group.default_assignee | Sys_id of the user that is the default assignee of the group. Data type: Object |
| team_success_score.sys_user_group.default_assignee.display_value | Display value
for default_assignee. Data type: String |
| team_success_score.sys_user_group.default_assignee.value | Internal value for
default_assignee. Data type: String |
| team_success_score.sys_user_group.description | Description of the group Data type: Object |
| team_success_score.sys_user_group.description.display_value | Display value for
description. Data type: String |
| team_success_score.sys_user_group.description.value | Internal value for
description. Data type: String |
| team_success_score.sys_user_group.email | Email address for the group. Data type: Object |
| team_success_score.sys_user_group.email.display_value | Display value for
email. Data type: String |
| team_success_score.sys_user_group.email.value | Internal value for email. Data type: String |
| team_success_score.sys_user_group.exclude_manager | Flag that indicates whether the manager of the group receives group emails. Possible values:
Data type: Object |
| team_success_score.sys_user_group.exclude_manager.display_value | Display value
for exclude_manager. Data type: String |
| team_success_score.sys_user_group.exclude_manager.value | Internal value for
exclude_manager. Data type: Boolean |
| team_success_score.sys_user_group.include_members | Flag that indicates whether the group members receive individual emails when someone sends an email to the group email address. The only exception to this functionality
is for approval notifications, whereby all members of a group receive an approval notification, regardless of this selection. Valid values:
Data type: Object |
| team_success_score.sys_user_group.include_members.display_value | Display value
for include_members. Data type: String |
| team_success_score.sys_user_group.include_members.value | Internal value for
include_members. Data type: Boolean |
| team_success_score.sys_user_group.manager | Sys_id of the manager of the group. Data type: Object |
| team_success_score.sys_user_group.manager.display_value | Display value for
manager. Data type: String |
| team_success_score.sys_user_group.manager.value | Internal value for
manager. Data type: String |
| team_success_score.sys_user_group.name | Name of the group. Data type: Object |
| team_success_score.sys_user_group.name.display_value | Display value for
name. Data type: String |
| team_success_score.sys_user_group.name.value | Internal value for name. Data type: String |
| team_success_score.sys_user_group.parent | Sys_id of the parent of this group. If a group has a parent, the child group inherits the roles of the parent group. The members of the child group are not members of the parent
group. For example, if an incident is assigned to the parent group and you click the Assigned to lookup icon, only the members in the parent group are available. The members of the child group are not available. Data type: Object |
| team_success_score.sys_user_group.parent.display_value | Display value for
parent. Data type: String |
| team_success_score.sys_user_group.parent.value | Internal value for parent. Data type: String |
| team_success_score.sys_user_group.roles | User roles assigned to the group. Data type: Object |
| team_success_score.sys_user_group.roles.display_value | Display value for
roles. Data type: String |
| team_success_score.sys_user_group.roles.value | Internal value for roles. Data type: String |
| team_success_score.sys_user_group.source | Source of the group. Data type: Object |
| team_success_score.sys_user_group.source.display_value | Display value for
source. Data type: String |
| team_success_score.sys_user_group.source.value | Internal value for source. Data type: String |
| team_success_score.sys_user_group.sys_created_by | User that created the group record. Data type: Object |
| team_success_score.sys_user_group.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| team_success_score.sys_user_group.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| team_success_score.sys_user_group.sys_created_on | Date and time that the group record was originally created. Data type: Object |
| team_success_score.sys_user_group.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| team_success_score.sys_user_group.sys_created_on.display_internal_value | Internal
display value for sys_created_on. Data type: String |
| team_success_score.sys_user_group.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| team_success_score.sys_user_group.sys_id | Sys_id for the group. Data type: Object |
| team_success_score.sys_user_group.sys_id.display_value | Display value for
sys_id. Data type: String |
| team_success_score.sys_user_group.sys_id.value | Internal value for sys_id. Data type: String |
| team_success_score.sys_user_group.sys_mod_count | Number of times that the associated group information has been modified. Data type: Object |
| team_success_score.sys_user_group.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| team_success_score.sys_user_group.sys_mod_count.value | Internal value for
sys_mod_count. Data type: Number |
| team_success_score.sys_user_group.sys_updated_by | User that last updated the group information. Data type: Object |
| team_success_score.sys_user_group.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| team_success_score.sys_user_group.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| team_success_score.sys_user_group.sys_updated_on | Date and time when the group information was last updated. Data type: Object |
| team_success_score.sys_user_group.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| team_success_score.sys_user_group.sys_updated_on.display_internal_value | Internal
display value for sys_updated_on. Data type: String |
| team_success_score.sys_user_group.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
| team_success_score.sys_user_group.type | Type of group. Data type: Object |
| team_success_score.sys_user_group.type.display_value | Display value for
type. Data type: String |
| team_success_score.sys_user_group.type.value | Internal value for type. Data type: String |
| type_success_score | Details about the type success score. Data type: Object |
| type_success_score.can_read | Flag that indicates whether a type success score
could be retrieved for the specified change request. Valid values:
Data type: Boolean |
| type_success_score.score | Details about the returned score indicator. Data type: Object |
| type_success_score.score.delta | Change in the score from the previous score. Data type: Object |
| type_success_score.score.delta.display_value | Display value for delta. Data type: String |
| type_success_score.score.delta.value | Internal value for delta. Data type: String |
| type_success_score.score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| type_success_score.score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| type_success_score.score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| type_success_score.score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| type_success_score.score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| type_success_score.score.value | Value returned by PA for the success score. Data type: String |
| type_success_score.type | Details about the type success score. Data type: Object |
| type_success_score.type.display_value | Label of the choice. Data type: String |
| type_success_score.type.sys_id | Sys_id of the Choice [sys_choice] record for the
specified change type. Data type: String |
| type_success_score.type.value | Value of the choice. Data type: String |
This code example shows how to retrieve the latest change team success score (original change success score based on group), model success score, and type success score based on the current GlideRecord using the getScoresForChange() method and then uses various attributes to filter the results and save a constructed success score summary in the work notes.
var changeSuccessScores = new sn_chg_score.ChangeSuccess().getScoresForChange(current);
gs.info(JSON.stringify(changeSuccessScores, null, 2));
var changeSuccessScoresSummary = "";
if (changeSuccessScores.team_success_score.can_read && changeSuccessScores.team_success_score.score.has_score)
changeSuccessScoresSummary += "Assignment group \"" + chgGr.assignment_group.getDisplayValue() + "\" has a success rating of \"" + changeSuccessScores.team_success_score.chg_success_score_rating.rating.display_value + "\" (Current team success score: " + changeSuccessScores.team_success_score.score.display_value + ")\n";
if (changeSuccessScores.model_success_score.can_read && changeSuccessScores.model_success_score.score.has_score)
changeSuccessScoresSummary += "Model \"" + changeSuccessScores.model_success_score.chg_model.name.display_value + "\" has a success rate of " + changeSuccessScores.model_success_score.score.display_value + "%\n";
if (changeSuccessScores.type_success_score.can_read && changeSuccessScores.type_success_score.score.has_score)
changeSuccessScoresSummary += "Type \"" + changeSuccessScores.type_success_score.type.display_value + "\" has a success rate of " + changeSuccessScores.type_success_score.score.display_value + "%\n";
if (changeSuccessScoresSummary !== "") {
changeSuccessScoresSummary = "Change success scores summary:\n\n" + changeSuccessScoresSummary;
chgGr.work_notes.setJournalEntry(changeSuccessScoresSummary);
chgGr.update();
}
Example return results:
{
"team_success_score": {
"can_read": true,
"sys_user_group": {
"parent": {
"display_value": "",
"value": ""
},
"manager": {
"display_value": "",
"value": ""
},
"roles": {
"display_value": "",
"value": ""
},
"sys_mod_count": {
"display_value": "0",
"value": 0
},
"description": {
"display_value": "",
"value": ""
},
"active": {
"display_value": "true",
"value": true
},
"source": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2018-03-07 21:00:41",
"value": "2018-03-07 21:00:41",
"display_value_internal": "2018-03-07 21:00:41"
},
"type": {
"display_value": "",
"value": ""
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_id": {
"display_value": "5f6441efc0a8010e0177fcb589156352",
"value": "5f6441efc0a8010e0177fcb589156352"
},
"sys_updated_by": {
"display_value": "glide.maint",
"value": "glide.maint"
},
"cost_center": {
"display_value": "",
"value": ""
},
"default_assignee": {
"display_value": "",
"value": ""
},
"sys_created_on": {
"display_value": "2018-03-07 21:00:41",
"value": "2018-03-07 21:00:41",
"display_value_internal": "2018-03-07 21:00:41"
},
"name": {
"display_value": "IT Securities",
"value": "IT Securities"
},
"exclude_manager": {
"display_value": "false",
"value": false
},
"email": {
"display_value": "",
"value": ""
},
"include_members": {
"display_value": "false",
"value": false
},
"sys_created_by": {
"display_value": "glide.maint",
"value": "glide.maint"
}
},
"score": {
"indicator": {
"name": "Change success scores",
"sys_id": "0ff316e173081010491d235f04f6a758"
},
"value": 465,
"display_value": "465",
"delta": {
"value": 0,
"display_value": "0"
},
"has_score": true
},
"chg_success_score_rating": {
"score_start": {
"display_value": "0",
"value": 0
},
"score_end": {
"display_value": "499",
"value": 499
},
"color": {
"display_value": "#FCCAC9",
"value": "#FCCAC9"
},
"rating": {
"display_value": "Low",
"value": "Low"
},
"sys_mod_count": {
"display_value": "0",
"value": 0
},
"active": {
"display_value": "true",
"value": true
},
"sys_overrides": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2020-03-27 07:43:29",
"value": "2020-03-27 07:43:29",
"display_value_internal": "2020-03-27 07:43:29"
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_class_name": {
"display_value": "Change Success Score Rating",
"value": "chg_success_score_rating"
},
"sys_id": {
"display_value": "7ad380b573330010491d235f04f6a717",
"value": "7ad380b573330010491d235f04f6a717"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"sys_created_on": {
"display_value": "2020-03-27 07:43:29",
"value": "2020-03-27 07:43:29",
"display_value_internal": "2020-03-27 07:43:29"
},
"sys_domain": {
"display_value": "global",
"value": "global"
},
"sys_name": {
"display_value": "Low",
"value": "Low"
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
}
}
},
"model_success_score": {
"can_read": true,
"chg_model": {
"color": {
"display_value": "",
"value": ""
},
"default_change_model": {
"display_value": "false",
"value": false
},
"description": {
"display_value": "This model can be used to capture unauthorized change events that were detected.",
"value": "This model can be used to capture unauthorized change events that were detected."
},
"sys_updated_on": {
"display_value": "2020-10-21 11:10:57",
"value": "2020-10-21 10:10:57",
"display_value_internal": "2020-10-21 11:10:57"
},
"table_name": {
"display_value": "change_request",
"value": "change_request"
},
"sys_class_name": {
"display_value": "Change Model",
"value": "chg_model"
},
"sys_id": {
"display_value": "aedc6a625323101034d1ddeeff7b1296",
"value": "aedc6a625323101034d1ddeeff7b1296"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"write_roles": {
"display_value": "",
"value": ""
},
"sys_created_on": {
"display_value": "2020-10-02 14:50:20",
"value": "2020-10-02 13:50:20",
"display_value_internal": "2020-10-02 14:50:20"
},
"read_roles": {
"display_value": "itil,sn_change_read",
"value": "itil,sn_change_read"
},
"sys_name": {
"display_value": "Unauthorized Change",
"value": "Unauthorized Change"
},
"advanced_security": {
"display_value": "false",
"value": false
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
},
"record_preset": {
"display_value": "type=emergency^short_description=An unauthorized change has been detected^assignment_group=a715cd759f2002002920bde8132e7018^work_start=javascript:gs.nowDateTime()^unauthorized=true^EQ",
"value": "type=emergency^short_description=An unauthorized change has been detected^assignment_group=a715cd759f2002002920bde8132e7018^work_start=javascript:gs.nowDateTime()^unauthorized=true^EQ"
},
"sys_mod_count": {
"display_value": "9",
"value": 9
},
"active": {
"display_value": "true",
"value": true
},
"sys_tags": {
"display_value": "",
"value": ""
},
"available_in_ui": {
"display_value": "false",
"value": false
},
"state_field": {
"display_value": "state",
"value": "state"
},
"name": {
"display_value": "Unauthorized Change",
"value": "Unauthorized Change"
},
"implementation_states": {
"display_value": "",
"value": ""
}
},
"score": {
"indicator": {
"name": "Change Model: % Successful and Successful With Issues",
"sys_id": "604f98dfc302011005aea539e540dd75"
},
"value": 76.92307692307693,
"display_value": "76.92",
"delta": {
"value": 0,
"display_value": "0.00"
},
"has_score": true
}
},
"type_success_score": {
"can_read": true,
"type": {
"sys_id": "e7a27d53cb100200d71cb9c0c24c9c2f",
"value": "normal",
"display_value": "Normal"
},
"score": {
"indicator": {
"name": "Change Type: % Successful and Successful With Issues",
"sys_id": "f9d25995c3ce011005aea539e540ddee"
},
"value": 74.29906542056075,
"display_value": "74.30",
"delta": {
"value": 0,
"display_value": "0.00"
},
"has_score": true
}
}
}
ChangeSuccess - getTeamScoreForChange(Object chgGr)
Returns the latest change team success score (original change success score based on group) based on the specified change request GlideRecord.
| Name | Type | Description |
|---|---|---|
| chgGr | Object | Change request GlideRecord for which to return the change team success score. |
| Parameter | Description |
|---|---|
| can_read | Flag that indicates whether a change team success score could be retrieved for the specified change request. Possible values:
Data type: Boolean |
| chg_success_score_rating | Individual objects for each field from the Change Success Score Rating [chg_success_score_rating] record that matches the returned score. Each field object has a key that is
the field name and contains value and display_value properties. If the field type is date/time, then the method also returns a display_value_internal
property which is in the user's timezone but in the system format YYYY-MM-DD HH24:MM:SS. Data type: Object |
| chg_success_score_rating.active | Flag that indicates whether the associated change success score record is active and available within the instance. Possible values:
Data type: Object |
| chg_success_score_rating.active.display_value | Display value for the active
flag. Data type: String |
| chg_success_score_rating.active.value | Internal value for the active flag. Data type: Boolean |
| chg_success_score_rating.color | Color of the associated change success score as shown in the Change Success Score Card for a change request. Data type: Object |
| chg_success_score_rating.color.display_value | Display value for color. Data type: String |
| chg_success_score_rating.color.value | Internal value for color. Data type: String |
| chg_success_score_rating.rating | Change success score rating, such as Low or High. Data type: Object |
| chg_success_score_rating.rating.display_value | Display value for rating. Data type: String |
| chg_success_score_rating.rating.value | Internal value for rating. Data type: String |
| chg_success_score_rating.score_end | Highest value in the change success score. Data type: Object |
| chg_success_score_rating.score_end.display_value | Display value for score_end. Data type: String |
| chg_success_score_rating.score_end.value | Internal value for score_end. Data type: Number |
| chg_success_score_rating.score_start | Lowest value in the change success score. Data type: Object |
| chg_success_score_rating.score_start.display_value | Display value for
score_start. Data type: String |
| chg_success_score_rating.score_start.value | Internal value for score_start. Data type: Number |
| chg_success_score_rating.sys_class_name | Change Success Score Rating table name. Always Change Success Score Rating/chg_success_score_rating. Data type: Object |
| chg_success_score_rating.sys_class_name.display_value | Display value for
sys_class_name. Data type: String |
| chg_success_score_rating.sys_class_name.value | Internal value for
sys_class_name. Data type: String |
| chg_success_score_rating.sys_created_by | Name of the user that initially created the associated change success score rating record. Data type: Object |
| chg_success_score_rating.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| chg_success_score_rating.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| chg_success_score_rating.sys_created_on | Date and time that the change success score rating record was originally created. Data type: Object |
| chg_success_score_rating.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| chg_success_score_rating.sys_created_on.display_value_internal | Internal display value
for sys_created_on. Data type: String |
| chg_success_score_rating.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| chg_success_score_rating.sys_domain | If using domains in the instance, the name of the domain to which the change success score record is associated. Data type: Object |
| chg_success_score_rating.sys_domain.display_value | Display value for sys_domain. Data type: String |
| chg_success_score_rating.sys_domain.value | Internal value for sys_domain. Data type: String |
| chg_success_score_rating.sys_id | Unique identifier of the associated change success score record. Data type: Object |
| chg_success_score_rating.sys_id.display_value | Display value for the sys_id. Data type: String |
| chg_success_score_rating.sys_id.value | Internal value for the sys_id. Data type: String |
| chg_success_score_rating.sys_mod_count | Number of times that the associated change success score record has been modified. Data type: Object |
| chg_success_score_rating.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| chg_success_score_rating.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| chg_success_score_rating.sys_name | Name of the change success score rating. Possible values:
Data type: Object |
| chg_success_score_rating.sys_name.display_value | Display value for sys_name. Data type: String |
| chg_success_score_rating.sys_name.value | Internal value for sys_name. Data type: String |
| chg_success_score_rating.sys_overrides | Sys_id of a record in the same table but in a domain above that of the current record. This allows a record in a lower domain to override a record in a domain above it. For example, if you have a rating record defined in the "global" domain but for domain "TOP/ACME" you override the record in "global". Data type: Object |
| chg_success_score_rating.sys_overrides.display_value | Display value for
sys_overrides. Data type: String |
| tchg_success_score_rating.sys_overrides.value | Internal value for sys_overrides. Data type: String |
| chg_success_score_rating.sys_tags | List of system tags associated with the change success score record. Data type: Object |
| chg_success_score_rating.sys_tags.display_value | Display value for sys_tags. Data type: String |
| chg_success_score_rating.sys_tags.value | Internal value for sys_tags. Data type: String |
| chg_success_score_rating.sys_updated_by | Name of the user that last updated the associated change success score record. Data type: Object |
| chg_success_score_rating.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| chg_success_score_rating.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| chg_success_score_rating.sys_updated_on | Date and time the associated change success score record was last updated. Data type: Object |
| chg_success_score_rating.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| chg_success_score_rating.sys_updated_on.display_value_internal | Internal display value
for sys_updated_on. Data type: String |
| chg_success_score_rating.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
| score | Details about the returned score indicator. Data type: Object |
| score.delta | Change in the score from the previous score. Data type: Object |
| score.delta.display_value | Display value for delta. Data type: String |
| score.delta.value | Internal value for delta. Data type: String |
| score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| score.value | Value returned by PA for the success score. Data type: String |
| sys_user_group | Individual objects for each field from the
Group [sys_user_group] record referenced by the specified change request. Each field
object has a key that is the field name and contains value and
display_value properties. If the field type is date/time,
then the method also returns a display_value_internal property
which is in the user's timezone but in the system format YYYY-MM-DD HH24:MM:SS. Data
type: Object |
| sys_user_group.active | Flag that indicates whether the group is active. Possible values:
Data type: Object |
| sys_user_group.active.display_value | Display value for the
active flag. Data type: String |
| sys_user_group.active.value | Internal value for the active
flag. Data type: Boolean |
| sys_user_group.cost_center | Sys_id of the cost center associated with the group. Data type: Object |
| sys_user_group.cost_center.display_value | Display value for
cost_center. Data type: String |
| sys_user_group.cost_center.value | Internal value for
cost_center. Data type: String |
| sys_user_group.default_assignee | Sys_id of the user that is the default assignee of the group. Data type: Object |
| sys_user_group.default_assignee.display_value | Display value
for default_assignee. Data type: String |
| sys_user_group.default_assignee.value | Internal value for
default_assignee. Data type: String |
| sys_user_group.description | Description of the group Data type: Object |
| sys_user_group.description.display_value | Display value for
description. Data type: String |
| sys_user_group.description.value | Internal value for
description. Data type: String |
| sys_user_group.email | Email address for the group. Data type: Object |
| sys_user_group.email.display_value | Display value for
email. Data type: String |
| sys_user_group.email.value | Internal value for email. Data type: String |
| sys_user_group.exclude_manager | Flag that indicates whether the manager of the group receives group emails. Possible values:
Data type: Object |
| sys_user_group.exclude_manager.display_value | Display value
for exclude_manager. Data type: String |
| sys_user_group.exclude_manager.value | Internal value for
exclude_manager. Data type: Boolean |
| sys_user_group.include_members | Flag that indicates whether the group members receive individual emails when someone sends an email to the group email address. The only exception to this functionality
is for approval notifications, whereby all members of a group receive an approval notification, regardless of this selection. Valid values:
Data type: Object |
| sys_user_group.include_members.display_value | Display value
for include_members. Data type: String |
| sys_user_group.include_members.value | Internal value for
include_members. Data type: Boolean |
| sys_user_group.manager | Sys_id of the manager of the group. Data type: Object |
| sys_user_group.manager.display_value | Display value for
manager. Data type: String |
| sys_user_group.manager.value | Internal value for
manager. Data type: String |
| sys_user_group.name | Name of the group. Data type: Object |
| sys_user_group.name.display_value | Display value for
name. Data type: String |
| sys_user_group.name.value | Internal value for name. Data type: String |
| sys_user_group.parent | Sys_id of the parent of this group. If a group has a parent, the child group inherits the roles of the parent group. The members of the child group are not members of the parent
group. For example, if an incident is assigned to the parent group and you click the Assigned to lookup icon, only the members in the parent group are available. The members of the child group are not available. Data type: Object |
| sys_user_group.parent.display_value | Display value for
parent. Data type: String |
| sys_user_group.parent.value | Internal value for parent. Data type: String |
| sys_user_group.roles | User roles assigned to the group. Data type: Object |
| sys_user_group.roles.display_value | Display value for
roles. Data type: String |
| sys_user_group.roles.value | Internal value for roles. Data type: String |
| sys_user_group.source | Source of the group. Data type: Object |
| sys_user_group.source.display_value | Display value for
source. Data type: String |
| sys_user_group.source.value | Internal value for source. Data type: String |
| sys_user_group.sys_created_by | User that created the group record. Data type: Object |
| sys_user_group.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| sys_user_group.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| sys_user_group.sys_created_on | Date and time that the group record was originally created. Data type: Object |
| sys_user_group.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| sys_user_group.sys_created_on.display_value_internal | Internal
display value for sys_created_on. Data type: String |
| sys_user_group.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| sys_user_group.sys_id | Sys_id for the group. Data type: Object |
| sys_user_group.sys_id.display_value | Display value for
sys_id. Data type: String |
| sys_user_group.sys_id.value | Internal value for sys_id. Data type: String |
| sys_user_group.sys_mod_count | Number of times that the associated group information has been modified. Data type: Object |
| sys_user_group.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| sys_user_group.sys_mod_count.value | Internal value for
sys_mod_count. Data type: Number |
| sys_user_group.sys_updated_by | User that last updated the group information. Data type: Object |
| sys_user_group.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| sys_user_group.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| sys_user_group.sys_updated_on | Date and time when the group information was last updated. Data type: Object |
| sys_user_group.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| sys_user_group.sys_updated_on.display_value_internal | Internal
display value for sys_updated_on. Data type: String |
| sys_user_group.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
| sys_user_group.type | Type of group. Data type: Object |
| sys_user_group.type.display_value | Display value for
type. Data type: String |
| sys_user_group.type.value | Internal value for type. Data type: String |
This example shows how to use the getTeamScoreForChange() method for the current change request GlideRecord to retrieve the team score for the change request and then use its various attributes to construct a score summary and write it in the work notes.
var changeTeamSuccess = new sn_chg_score.ChangeSuccess().getTeamScoreForChange(current);
gs.info(JSON.stringify(changeTeamSuccess, null, 2));
if (changeTeamSuccess.can_read && changeTeamSuccess.score.has_score && changeTeamSuccess.chg_success_score_rating.rating.value === "Low") {
chgGr.work_notes.setJournalEntry("The selected assignment group \"" + chgGr.assignment_group.getDisplayValue() + "\" has a " + changeTeamSuccess.chg_success_score_rating.rating.display_value + " success rating (current success score is: " + changeTeamSuccess.score.display_value + ").\nConsider adding additional approvers or discuss with your Change Manager.");
chgGr.update();
}
Sample return results:
{
"can_read": true,
"sys_user_group": {
"parent": {
"display_value": "",
"value": ""
},
"manager": {
"display_value": "",
"value": ""
},
"roles": {
"display_value": "",
"value": ""
},
"sys_mod_count": {
"display_value": "0",
"value": 0
},
"description": {
"display_value": "",
"value": ""
},
"active": {
"display_value": "true",
"value": true
},
"source": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2018-03-07 21:00:41",
"value": "2018-03-07 21:00:41",
"display_value_internal": "2018-03-07 21:00:41"
},
"type": {
"display_value": "",
"value": ""
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_id": {
"display_value": "5f6441efc0a8010e0177fcb589156352",
"value": "5f6441efc0a8010e0177fcb589156352"
},
"sys_updated_by": {
"display_value": "glide.maint",
"value": "glide.maint"
},
"cost_center": {
"display_value": "",
"value": ""
},
"default_assignee": {
"display_value": "",
"value": ""
},
"sys_created_on": {
"display_value": "2018-03-07 21:00:41",
"value": "2018-03-07 21:00:41",
"display_value_internal": "2018-03-07 21:00:41"
},
"name": {
"display_value": "IT Securities",
"value": "IT Securities"
},
"exclude_manager": {
"display_value": "false",
"value": false
},
"email": {
"display_value": "",
"value": ""
},
"include_members": {
"display_value": "false",
"value": false
},
"sys_created_by": {
"display_value": "glide.maint",
"value": "glide.maint"
}
},
"score": {
"indicator": {
"name": "Change success scores",
"sys_id": "0ff316e173081010491d235f04f6a758"
},
"value": 465,
"display_value": "465",
"delta": {
"value": 0,
"display_value": "0"
},
"has_score": true
},
"chg_success_score_rating": {
"score_start": {
"display_value": "0",
"value": 0
},
"score_end": {
"display_value": "499",
"value": 499
},
"color": {
"display_value": "#FCCAC9",
"value": "#FCCAC9"
},
"rating": {
"display_value": "Low",
"value": "Low"
},
"sys_mod_count": {
"display_value": "0",
"value": 0
},
"active": {
"display_value": "true",
"value": true
},
"sys_overrides": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2020-03-27 07:43:29",
"value": "2020-03-27 07:43:29",
"display_value_internal": "2020-03-27 07:43:29"
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_class_name": {
"display_value": "Change Success Score Rating",
"value": "chg_success_score_rating"
},
"sys_id": {
"display_value": "7ad380b573330010491d235f04f6a717",
"value": "7ad380b573330010491d235f04f6a717"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"sys_created_on": {
"display_value": "2020-03-27 07:43:29",
"value": "2020-03-27 07:43:29",
"display_value_internal": "2020-03-27 07:43:29"
},
"sys_domain": {
"display_value": "global",
"value": "global"
},
"sys_name": {
"display_value": "Low",
"value": "Low"
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
}
}
}
ChangeSuccess - getTeamScoreForGroupId(String sys_id, String domain_id)
Returns the latest change team success score (original change success score based on group) for the specified group.
| Name | Type | Description |
|---|---|---|
| sys_id | String | Sys_id of the group for which to return the change team success score. Located in the User Group [sys_user_group] table. |
| domain_id | String | Optional. Sys_id of a domain to use when querying Performance Analytics for the team success score. |
| Parameter | Description |
|---|---|
| can_read | Flag that indicates whether a change team success score could be retrieved for the specified change request. Possible values:
Data type: Boolean |
| chg_success_score_rating | Individual objects for each field from the Change Success Score Rating [chg_success_score_rating] record that matches the returned score. Each field object has a key that is
the field name and contains value and display_value properties. If the field type is date/time, then the method also returns a display_value_internal
property which is in the user's timezone but in the system format YYYY-MM-DD HH24:MM:SS. Data type: Object |
| chg_success_score_rating.active | Flag that indicates whether the associated change success score record is active and available within the instance. Possible values:
Data type: Object |
| chg_success_score_rating.active.display_value | Display value for the active
flag. Data type: String |
| chg_success_score_rating.active.value | Internal value for the active flag. Data type: Boolean |
| chg_success_score_rating.color | Color of the associated change success score as shown in the Change Success Score Card for a change request. Data type: Object |
| chg_success_score_rating.color.display_value | Display value for color. Data type: String |
| chg_success_score_rating.color.value | Internal value for color. Data type: String |
| chg_success_score_rating.rating | Change success score rating, such as Low or High. Data type: Object |
| chg_success_score_rating.rating.display_value | Display value for rating. Data type: String |
| chg_success_score_rating.rating.value | Internal value for rating. Data type: String |
| chg_success_score_rating.score_end | Highest value in the change success score. Data type: Object |
| chg_success_score_rating.score_end.display_value | Display value for score_end. Data type: String |
| chg_success_score_rating.score_end.value | Internal value for score_end. Data type: Number |
| chg_success_score_rating.score_start | Lowest value in the change success score. Data type: Object |
| chg_success_score_rating.score_start.display_value | Display value for
score_start. Data type: String |
| chg_success_score_rating.score_start.value | Internal value for score_start. Data type: Number |
| chg_success_score_rating.sys_class_name | Change Success Score Rating table name. Always Change Success Score Rating/chg_success_score_rating. Data type: Object |
| chg_success_score_rating.sys_class_name.display_value | Display value for
sys_class_name. Data type: String |
| chg_success_score_rating.sys_class_name.value | Internal value for
sys_class_name. Data type: String |
| chg_success_score_rating.sys_created_by | Name of the user that initially created the associated change success score rating record. Data type: Object |
| chg_success_score_rating.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| chg_success_score_rating.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| chg_success_score_rating.sys_created_on | Date and time that the change success score rating record was originally created. Data type: Object |
| chg_success_score_rating.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| chg_success_score_rating.sys_created_on.display_value_internal | Internal display value
for sys_created_on. Data type: String |
| chg_success_score_rating.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| chg_success_score_rating.sys_domain | If using domains in the instance, the name of the domain to which the change success score record is associated. Data type: Object |
| chg_success_score_rating.sys_domain.display_value | Display value for sys_domain. Data type: String |
| chg_success_score_rating.sys_domain.value | Internal value for sys_domain. Data type: String |
| chg_success_score_rating.sys_id | Unique identifier of the associated change success score record. Data type: Object |
| chg_success_score_rating.sys_id.display_value | Display value for the sys_id. Data type: String |
| chg_success_score_rating.sys_id.value | Internal value for the sys_id. Data type: String |
| chg_success_score_rating.sys_mod_count | Number of times that the associated change success score record has been modified. Data type: Object |
| chg_success_score_rating.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| chg_success_score_rating.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| chg_success_score_rating.sys_name | Name of the change success score rating. Possible values:
Data type: Object |
| chg_success_score_rating.sys_name.display_value | Display value for sys_name. Data type: String |
| chg_success_score_rating.sys_name.value | Internal value for sys_name. Data type: String |
| chg_success_score_rating.sys_overrides | Sys_id of a record in the same table but in a domain above that of the current record. This allows a record in a lower domain to override a record in a domain above it. For example, if you have a rating record defined in the "global" domain but for domain "TOP/ACME" you override the record in "global". Data type: Object |
| chg_success_score_rating.sys_overrides.display_value | Display value for
sys_overrides. Data type: String |
| tchg_success_score_rating.sys_overrides.value | Internal value for sys_overrides. Data type: String |
| chg_success_score_rating.sys_tags | List of system tags associated with the change success score record. Data type: Object |
| chg_success_score_rating.sys_tags.display_value | Display value for sys_tags. Data type: String |
| chg_success_score_rating.sys_tags.value | Internal value for sys_tags. Data type: String |
| chg_success_score_rating.sys_updated_by | Name of the user that last updated the associated change success score record. Data type: Object |
| chg_success_score_rating.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| chg_success_score_rating.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| chg_success_score_rating.sys_updated_on | Date and time the associated change success score record was last updated. Data type: Object |
| chg_success_score_rating.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| chg_success_score_rating.sys_updated_on.display_value_internal | Internal display value
for sys_updated_on. Data type: String |
| chg_success_score_rating.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
| score | Details about the returned score indicator. Data type: Object |
| score.delta | Change in the score from the previous score. Data type: Object |
| score.delta.display_value | Display value for delta. Data type: String |
| score.delta.value | Internal value for delta. Data type: String |
| score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| score.value | Value returned by PA for the success score. Data type: String |
| sys_user_group | Individual objects for each field from the
Group [sys_user_group] record referenced by the specified change request. Each field
object has a key that is the field name and contains value and
display_value properties. If the field type is date/time,
then the method also returns a display_value_internal property
which is in the user's timezone but in the system format YYYY-MM-DD HH24:MM:SS. Data
type: Object |
| sys_user_group.active | Flag that indicates whether the group is active. Possible values:
Data type: Object |
| sys_user_group.active.display_value | Display value for the
active flag. Data type: String |
| sys_user_group.active.value | Internal value for the active
flag. Data type: Boolean |
| sys_user_group.cost_center | Sys_id of the cost center associated with the group. Data type: Object |
| sys_user_group.cost_center.display_value | Display value for
cost_center. Data type: String |
| sys_user_group.cost_center.value | Internal value for
cost_center. Data type: String |
| sys_user_group.default_assignee | Sys_id of the user that is the default assignee of the group. Data type: Object |
| sys_user_group.default_assignee.display_value | Display value
for default_assignee. Data type: String |
| sys_user_group.default_assignee.value | Internal value for
default_assignee. Data type: String |
| sys_user_group.description | Description of the group Data type: Object |
| sys_user_group.description.display_value | Display value for
description. Data type: String |
| sys_user_group.description.value | Internal value for
description. Data type: String |
| sys_user_group.email | Email address for the group. Data type: Object |
| sys_user_group.email.display_value | Display value for
email. Data type: String |
| sys_user_group.email.value | Internal value for email. Data type: String |
| sys_user_group.exclude_manager | Flag that indicates whether the manager of the group receives group emails. Possible values:
Data type: Object |
| sys_user_group.exclude_manager.display_value | Display value
for exclude_manager. Data type: String |
| sys_user_group.exclude_manager.value | Internal value for
exclude_manager. Data type: Boolean |
| sys_user_group.include_members | Flag that indicates whether the group members receive individual emails when someone sends an email to the group email address. The only exception to this functionality
is for approval notifications, whereby all members of a group receive an approval notification, regardless of this selection. Valid values:
Data type: Object |
| sys_user_group.include_members.display_value | Display value
for include_members. Data type: String |
| sys_user_group.include_members.value | Internal value for
include_members. Data type: Boolean |
| sys_user_group.manager | Sys_id of the manager of the group. Data type: Object |
| sys_user_group.manager.display_value | Display value for
manager. Data type: String |
| sys_user_group.manager.value | Internal value for
manager. Data type: String |
| sys_user_group.name | Name of the group. Data type: Object |
| sys_user_group.name.display_value | Display value for
name. Data type: String |
| sys_user_group.name.value | Internal value for name. Data type: String |
| sys_user_group.parent | Sys_id of the parent of this group. If a group has a parent, the child group inherits the roles of the parent group. The members of the child group are not members of the parent
group. For example, if an incident is assigned to the parent group and you click the Assigned to lookup icon, only the members in the parent group are available. The members of the child group are not available. Data type: Object |
| sys_user_group.parent.display_value | Display value for
parent. Data type: String |
| sys_user_group.parent.value | Internal value for parent. Data type: String |
| sys_user_group.roles | User roles assigned to the group. Data type: Object |
| sys_user_group.roles.display_value | Display value for
roles. Data type: String |
| sys_user_group.roles.value | Internal value for roles. Data type: String |
| sys_user_group.source | Source of the group. Data type: Object |
| sys_user_group.source.display_value | Display value for
source. Data type: String |
| sys_user_group.source.value | Internal value for source. Data type: String |
| sys_user_group.sys_created_by | User that created the group record. Data type: Object |
| sys_user_group.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| sys_user_group.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| sys_user_group.sys_created_on | Date and time that the group record was originally created. Data type: Object |
| sys_user_group.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| sys_user_group.sys_created_on.display_value_internal | Internal
display value for sys_created_on. Data type: String |
| sys_user_group.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| sys_user_group.sys_id | Sys_id for the group. Data type: Object |
| sys_user_group.sys_id.display_value | Display value for
sys_id. Data type: String |
| sys_user_group.sys_id.value | Internal value for sys_id. Data type: String |
| sys_user_group.sys_mod_count | Number of times that the associated group information has been modified. Data type: Object |
| sys_user_group.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| sys_user_group.sys_mod_count.value | Internal value for
sys_mod_count. Data type: Number |
| sys_user_group.sys_updated_by | User that last updated the group information. Data type: Object |
| sys_user_group.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| sys_user_group.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| sys_user_group.sys_updated_on | Date and time when the group information was last updated. Data type: Object |
| sys_user_group.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| sys_user_group.sys_updated_on.display_value_internal | Internal
display value for sys_updated_on. Data type: String |
| sys_user_group.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
| sys_user_group.type | Type of group. Data type: Object |
| sys_user_group.type.display_value | Display value for
type. Data type: String |
| sys_user_group.type.value | Internal value for type. Data type: String |
The following code example shows how to use the getTeamScoreForGroupId()
method to retrieve the team score for a group, filter through the requested records, and
then places all low group scores and deltas in the event queue
change_success.team.warning of the associated group record.
var chgGroupGr = new GlideAggregate("change_request");
chgGroupGr.addInactiveQuery();
chgGroupGr.addNotNullQuery("close_code");
chgGroupGr.groupBy("assignment_group");
chgGroupGr.query();
while (chgGroupGr.next()) {
var groupId = chgGroupGr.getValue("assignment_group");
var changeTeamSuccess = new sn_chg_score.ChangeSuccess().getTeamScoreForGroupId(groupId);
if (changeTeamSuccess.can_read && changeTeamSuccess.score.has_score && changeTeamSuccess.chg_success_score_rating.rating.value === "Low") {
var grpGr = new GlideRecord("sys_user_group");
grpGr.get(groupId);
gs.eventQueue("change_success.team.warning", grpGr, changeTeamSuccess.score.value, changeTeamSuccess.score.delta.value);
}
}
Example of the return results when calling this method:
{
"can_read": true,
"sys_user_group": {
"parent": {
"display_value": "",
"value": ""
},
"manager": {
"display_value": "",
"value": ""
},
"roles": {
"display_value": "",
"value": ""
},
"sys_mod_count": {
"display_value": "1",
"value": 1
},
"description": {
"display_value": "LDAP admins group",
"value": "LDAP admins group"
},
"active": {
"display_value": "true",
"value": true
},
"source": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2013-07-26 22:48:47",
"value": "2013-07-26 21:48:47",
"display_value_internal": "2013-07-26 22:48:47"
},
"type": {
"display_value": "",
"value": ""
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_id": {
"display_value": "dc0db135c332010016194ffe5bba8f23",
"value": "dc0db135c332010016194ffe5bba8f23"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"cost_center": {
"display_value": "",
"value": ""
},
"default_assignee": {
"display_value": "",
"value": ""
},
"sys_created_on": {
"display_value": "2013-07-26 22:12:56",
"value": "2013-07-26 21:12:56",
"display_value_internal": "2013-07-26 22:12:56"
},
"name": {
"display_value": "LDAP Admins",
"value": "LDAP Admins"
},
"exclude_manager": {
"display_value": "false",
"value": false
},
"email": {
"display_value": "",
"value": ""
},
"include_members": {
"display_value": "false",
"value": false
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
}
},
"score": {
"indicator": {
"name": "Change success scores",
"sys_id": "0ff316e173081010491d235f04f6a758"
},
"value": 510,
"display_value": "510",
"delta": {
"value": 0,
"display_value": "0"
},
"has_score": true
},
"chg_success_score_rating": {
"score_start": {
"display_value": "500",
"value": 500
},
"score_end": {
"display_value": "599",
"value": 599
},
"color": {
"display_value": "#FDEEC5",
"value": "#FDEEC5"
},
"rating": {
"display_value": "Medium",
"value": "Medium"
},
"sys_mod_count": {
"display_value": "0",
"value": 0
},
"active": {
"display_value": "true",
"value": true
},
"sys_overrides": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2020-03-27 07:44:07",
"value": "2020-03-27 07:44:07",
"display_value_internal": "2020-03-27 07:44:07"
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_class_name": {
"display_value": "Change Success Score Rating",
"value": "chg_success_score_rating"
},
"sys_id": {
"display_value": "5dc448fd73330010491d235f04f6a7de",
"value": "5dc448fd73330010491d235f04f6a7de"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"sys_created_on": {
"display_value": "2020-03-27 07:44:07",
"value": "2020-03-27 07:44:07",
"display_value_internal": "2020-03-27 07:44:07"
},
"sys_domain": {
"display_value": "global",
"value": "global"
},
"sys_name": {
"display_value": "Medium",
"value": "Medium"
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
}
}
}
ChangeSuccess - getTypeScoreForChange(Object chgGr)
Returns the latest type success score based on the specified change request GlideRecord.
| Name | Type | Description |
|---|---|---|
| chgGr | Object | Change request GlideRecord for which to return the type success score. |
| Parameter | Description |
|---|---|
| can_read | Flag that indicates whether a type success score
could be retrieved for the specified change request. Valid values:
Data type: Boolean |
| score | Details about the returned score indicator. Data type: Object |
| score.delta | Change in the score from the previous score. Data type: Object |
| score.delta.display_value | Display value for delta. Data type: String |
| score.delta.value | Internal value for delta. Data type: String |
| score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| score.value | Value returned by PA for the success score. Data type: String |
| type | Details about the type success score. Data type: Object |
| type.display_value | Label of the choice. Data type: String |
| type.sys_id | Sys_id of the Choice [sys_choice] record for the
specified change type. Data type: String |
| type.value | Value of the choice. Data type: String |
This code example shows how to retrieve the latest type success score based on the current GlideRecord for change models that the user has read access for and have a success score value that is less than 50%. It then stores them in the work notes.
var changeTypeSuccess = new sn_chg_score.ChangeSuccess().getTypeScoreForChange(current);
gs.info(JSON.stringify(changeTypeSuccess, null, 2));
if (changeTypeSuccess.can_read && changeTypeSuccess.score.has_score && changeTypeSuccess.score.value < 50) {
current.work_notes.setJournalEntry("The selected Change Type of \"" + changeTypeSuccess.type.display_value + "\" has a success rate of less than 50% (current success rate is: " + changeTypeSuccess.score.display_value + "%).\nConsider using a different Type or adding additional approvers or discuss with your Change Manager.");
current.update();
}
Example of the return results when calling this method:
{
"can_read": true,
"type": {
"sys_id": "e7a27d53cb100200d71cb9c0c24c9c2f",
"value": "normal",
"display_value": "Normal"
},
"score": {
"indicator": {
"name": "Change Type: % Successful and Successful With Issues",
"sys_id": "f9d25995c3ce011005aea539e540ddee"
},
"value": 74.29906542056075,
"display_value": "74.30",
"delta": {
"value": 0,
"display_value": "0.00"
},
"has_score": true
}
}
ChangeSuccess - getTypeScoreForType(String type, String domain_id)
Returns the latest type success score for the specified change type.
| Name | Type | Description |
|---|---|---|
| type | String | Type of change request for which to return the type success score, such as "emergency". |
| domain_id | String | Optional. Sys_id of a domain to use when querying Performance Analytics for the type success score. |
| Parameter | Description |
|---|---|
| can_read | Flag that indicates whether a type success score
could be retrieved for the specified change request. Valid values:
Data type: Boolean |
| score | Details about the returned score indicator. Data type: Object |
| score.delta | Change in the score from the previous score. Data type: Object |
| score.delta.display_value | Display value for delta. Data type: String |
| score.delta.value | Internal value for delta. Data type: String |
| score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| score.value | Value returned by PA for the success score. Data type: String |
| type | Details about the type success score. Data type: Object |
| type.sys_id | Sys_id of the Choice [sys_choice] record for the
specified change type. Data type: String |
| type.value | Value of the choice. Data type: String |
| type.display_value | Label of the choice. Data type: String |
The following code example shows how to use the getTypeScoreForType()
method to retrieve the type score for specified types (name, element, and language) and
filter through the requested records. It then places all type scores that are less than 65%
in the event queue change_success.type.warning of the associated sys_choice
record.
var chgTypeGr = new GlideRecord("sys_choice");
chgTypeGr.addQuery("name", "change_request");
chgTypeGr.addQuery("element", "type");
chgTypeGr.addQuery("language", "en");
chgTypeGr.query();
while (chgTypeGr.next()) {
var changeTypeSuccess = new sn_chg_score.ChangeSuccess().getTypeScoreForType(chgTypeGr.getValue("value"));
if (changeTypeSuccess.can_read && changeTypeSuccess.score.has_score && changeTypeSuccess.score.value < 65)
gs.eventQueue("change_success.type.warning", chgTypeGr, changeTypeSuccess.score.value, changeTypeSuccess.score.delta.value);
}
Example of the return results when calling this method:
{
"can_read": true,
"type": {
"sys_id": "2ba27d53cb100200d71cb9c0c24c9c2f",
"value": "emergency",
"display_value": "Emergency"
},
"score": {
"indicator": {
"name": "Change Type: % Successful and Successful With Issues",
"sys_id": "f9d25995c3ce011005aea539e540ddee"
},
"value": 82.97872340425532,
"display_value": "82.98",
"delta": {
"value": 0,
"display_value": "0.00"
},
"has_score": true
}
}
ChangeSuccess - withIndicatorScores(Boolean toggle)
Controls whether the associated method returns the details of the Performance Analytics (PA) indicators used to generate each of the different types of scores (team, model and type). By default, this information is not returned.
| Name | Type | Description |
|---|---|---|
| toggle | Boolean | Flag that indicates whether to include the details of the PA
indicators. Valid values:
Default: false |
| Parameter | Description |
|---|---|
| indicator_scores | Details about the returned score indicator. Data type: Object |
| indicator_scores.delta | Change in the score from the previous score. Data type: Object |
| indicator_scores.delta.display_value | Display value for delta. Data type: String |
| indicator_scores.delta.value | Internal value for delta. Data type: String |
| indicator_scores.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| indicator_scores.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| indicator_scores.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| indicator_scores.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| indicator_scores.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| indicator_scores.value | Value returned by PA for the success score. Data type: String |
The following example shows how to request that the indicator scores not be returned in a getScoresForChange() call.
var chgGr = new GlideRecord("change_request");
chgGr.get("number", "CHG0030305");
gs.info(JSON.stringify(new sn_chg_score.ChangeSuccess().withIndicatorScores(false).getScoresForChange(chgGr), null, 2));
The following output only shows the indicator score values that are returned if this helper is set to true. Other values may also be returned based on the method that this helper is attached to.
"indicator_scores": [
{
"indicator": {
"name": "Total changes",
"sys_id": "966e899173401010491d235f04f6a7ef"
},
"value": 11,
"display_value": "11",
"delta": {
"value": 0,
"display_value": "0"
},
"has_score": true
}
]
ChangeSuccess - withModelScore(Boolean toggle)
Only valid when called with the getScoresForChange() method. Controls whether the getScoresForChange() method returns the model score. By default the model score is returned.
Use this method to toggle the return of this data on or off for the current ChangeSuccess object.
| Name | Type | Description |
|---|---|---|
| toggle | Boolean | Flag that indicates whether to include the model success score. Valid values:
Default: true |
| Parameter | Description |
|---|---|
| model_success_score | Details on the model success score. Data type: Object |
| model_success_score.can_read | Flag that indicates whether a model success score could be retrieved for the specified change request. Possible values:
Data type: Boolean |
| model_success_score.chg_model | Individual objects for each field in the Change Model [chg_model] record referenced by the specified change request. Each object has a key that is the field name and contains value and
display_value properties. If the field type is date/time, then the method also returns a display_value_internal property which is in the user's timezone but in the system format YYYY-MM-DD
HH24:MM:SS.Data type: Object |
| model_success_score.chg_model.active | Flag that indicates whether the associated change model record is active and available within the instance. Possible values:
Data type: Object |
| model_success_score.chg_model.active.display_value | Display value for the active
flag. Data type: String |
| model_success_score.chg_model.active.value | Internal value for the active flag. Data type: Boolean |
| model_success_score.chg_model.advanced_security | Flag that indicates whether user criteria based security is being used in addition to role based security for this change model. Possible values:
Data type: Object |
| model_success_score.chg_model.advanced_security.display_value | Display value for the advanced_security flag. Data type: String |
| model_success_score.chg_model.advanced_security.value | Internal value for the advanced_security flag. Data type: Boolean |
| model_success_score.chg_model.available_in_ui | Flag that indicates whether the associated change model record is available within the user interface. Possible values:
Data type: Object |
| model_success_score.chg_model.available_in_ui.display_value | Display value for the available_in_ui flag. Data type: String |
| model_success_score.chg_model.available_in_ui.value | Value for the available_in_ui flag. Data type: Boolean |
| model_success_score.chg_model.color | Color of the associated change model on the change request landing page. Data type: Object |
| model_success_score.chg_model.color.display_value | Display value for color. Data type: String |
| model_success_score.chg_model.color.value | Internal value for color. Data type: String |
| model_success_score.chg_model.default_change_model | Flag that indicates whether the associated change model record is the default change model. Possible values:
Data type: Object |
| model_success_score.chg_model.default_change_model.display_value | Display value for the default change model flag. Data type: String |
| model_success_score.chg_model.default_change_model.value | Internal value for the default change model flag. Data type: Boolean |
| model_success_score.chg_model.description | Short description of the purpose of the change model. Data type: Object |
| model_success_score.chg_model.description.display_value | Display value for description. Data type: String |
| model_success_score.chg_model.description.value | Internal value for description. Data type: String |
| model_success_score.chg_model.name | Name of the change model. Data type: Object |
| model_success_score.chg_model.name.display_value | Display value for name. Data type: String |
| model_success_score.chg_model.name.value | Internal value for name. Data type: String |
| model_success_score.chg_model.record_preset | Name-value pairs of the fields that should automatically be populated, with their associated values, when a new change request record is created. Values are separated by caret
symbols. For example:
Data type: Object |
| model_success_score.chg_model.record_preset.display_value | Display value for record_preset. Data type: String |
| model_success_score.chg_model.record_preset.value | Internal value for record_preset. Data type: String |
| model_success_score.chg_model.state_field | Choice list field from which to collect choices, based on the value provided in table_name. For change models, this is always set to "state". Data type: Object |
| model_success_score.chg_model.state_field.display_value | Display value for state_field. Data type: String |
| model_success_score.chg_model.state_field.value | Internal value for state_field. Data type: String |
| model_success_score.chg_model.sys_class_name | Change module table name. Always Change Model/chg_model. Data type: Object |
| model_success_score.chg_model.sys_class_name.display_value | Display value for sys_class_name. Data type: String |
| model_success_score.chg_model.sys_class_name.value | Internal value for sys_class_name. Data type: String |
| model_success_score.chg_model.sys_created_by | Name of the user that initially created the associated change module record. Data type: Object |
| model_success_score.chg_model.sys_created_by.display_value | Display value for sys_created_by. Data type: String |
| model_success_score.chg_model.sys_created_by.value | Internal value for sys_created_by. Data type: String |
| model_success_score.chg_model.sys_created_on | Date and time that the change module record was originally created. Data type: Object |
| model_success_score.chg_model.sys_created_on.display_value | Display value for sys_created_on. Data type: String |
| model_success_score.chg_model.sys_created_on.display_value_internal | Internal display value for sys_created_on. Data type: String |
| model_success_score.chg_model.sys_created_on.value | Internal value for sys_created_on. Data type: String |
| model_success_score.chg_model.sys_domain | If using domains in the instance, the name of the domain to which the change module record is associated. Data type: Object |
| model_success_score.chg_model.sys_domain.display_value | Display value for sys_domain. Data type: String |
| model_success_score.chg_model.sys_domain.value | Internal value for sys_domain. Data type: String |
| model_success_score.chg_model.sys_domain_path | If using domains in the instance, the domain path in which the associated change module record resides. Data type: Object |
| model_success_score.chg_model.sys_domain_path.display_value | Display value for sys_domain_path. Data type: String |
| model_success_score.chg_model.sys_domain_path.value | Internal value for sys_domain_path. Data type: String |
| model_success_score.chg_model.sys_id | Unique identifier of the associated change model record. Data type: Object |
| model_success_score.chg_model.sys_id.display_value | Display value for sys_id. Data type: String |
| model_success_score.chg_model.sys_id.value | Internal value for sys_id. Data type: String |
| model_success_score.chg_model.sys_mod_count | Number of times that the associated change model record has been modified. Data type: Object |
| model_success_score.chg_model.sys_mod_count.display_value | Display value for sys_mod_count. Data type: String |
| model_success_score.chg_model.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| model_success_score.chg_model.sys_name | Name of the change model. Always the same as the name parameter. Data type: Object |
| model_success_score.chg_model.sys_name.display_value | Display value for sys_name. Data type: String |
| model_success_score.chg_model.sys_name.value | Internal value for sys_name. Data type: String |
| model_success_score.chg_model.sys_updated_by | Name of the user that last updated the associated change model record. Data type: Object |
| model_success_score.chg_model.sys_updated_by.display_value | Display value for sys_updated_by. Data type: String |
| model_success_score.chg_model.sys_updated_by.value | Internal value for sys_updated_by. Data type: String |
| model_success_score.chg_model.sys_updated_on | Date and time the associated change model record was last updated. Data type: Object |
| model_success_score.chg_model.sys_updated_on.display_value | Display value for sys_updated_on. Data type: String |
| model_success_score.chg_model.sys_updated_on.display_value_internal | Internal display value for sys_updated_on. Data type: String |
| model_success_score.chg_model.sys_updated_on.value | Internal value for sys_updated_on. Data type: String |
| model_success_score.chg_model.table_name | Table that defines the Choice list field from which to collect choices. For change models this is always set to "change_request". Data type: String Maximum length: 80 |
| model_success_score.score | Details about the returned score indicator. Data type: Object |
| model_success_score.score.delta | Change in the score from the previous score. Data type: Object |
| model_success_score.score.delta.display_value | Display value for delta. Data type: String |
| model_success_score.score.delta.value | Internal value for delta. Data type: String |
| model_success_score.score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| model_success_score.score.score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| model_success_score.score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| model_success_score.score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| model_success_score.score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| model_success_score.score.value | Value returned by PA for the success score. Data type: String |
The following example shows how to request that the model score information not be returned in a getScoresForChange() call.
var chgGr = new GlideRecord("change_request");
chgGr.get("number", "CHG0030305");
gs.info(JSON.stringify(new sn_chg_score.ChangeSuccess().withModelScore(false).getScoresForChange(chgGr), null, 2));
The following output only shows the model success score values that are returned if this helper is set to true. To see the other scores that may be returned, see getScoresForChange().
"model_success_score": {
"can_read": true,
"chg_model": {
"color": {
"display_value": "",
"value": ""
},
"default_change_model": {
"display_value": "false",
"value": false
},
"description": {
"display_value": "This model can be used to capture unauthorized change events that were detected.",
"value": "This model can be used to capture unauthorized change events that were detected."
},
"sys_updated_on": {
"display_value": "2020-10-21 11:10:57",
"value": "2020-10-21 10:10:57",
"display_value_internal": "2020-10-21 11:10:57"
},
"table_name": {
"display_value": "change_request",
"value": "change_request"
},
"sys_class_name": {
"display_value": "Change Model",
"value": "chg_model"
},
"sys_id": {
"display_value": "aedc6a625323101034d1ddeeff7b1296",
"value": "aedc6a625323101034d1ddeeff7b1296"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"write_roles": {
"display_value": "",
"value": ""
},
"sys_created_on": {
"display_value": "2020-10-02 14:50:20",
"value": "2020-10-02 13:50:20",
"display_value_internal": "2020-10-02 14:50:20"
},
"read_roles": {
"display_value": "itil,sn_change_read",
"value": "itil,sn_change_read"
},
"sys_name": {
"display_value": "Unauthorized Change",
"value": "Unauthorized Change"
},
"advanced_security": {
"display_value": "false",
"value": false
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
},
"record_preset": {
"display_value": "type=emergency^short_description=An unauthorized change has been detected^assignment_group=a715cd759f2002002920bde8132e7018^work_start=javascript:gs.nowDateTime()^unauthorized=true^EQ",
"value": "type=emergency^short_description=An unauthorized change has been detected^assignment_group=a715cd759f2002002920bde8132e7018^work_start=javascript:gs.nowDateTime()^unauthorized=true^EQ"
},
"sys_mod_count": {
"display_value": "9",
"value": 9
},
"active": {
"display_value": "true",
"value": true
},
"sys_tags": {
"display_value": "",
"value": ""
},
"available_in_ui": {
"display_value": "false",
"value": false
},
"state_field": {
"display_value": "state",
"value": "state"
},
"name": {
"display_value": "Unauthorized Change",
"value": "Unauthorized Change"
},
"implementation_states": {
"display_value": "",
"value": ""
}
},
"score": {
"indicator": {
"name": "Change Model: % Successful and Successful With Issues",
"sys_id": "604f98dfc302011005aea539e540dd75"
},
"value": 76.92307692307693,
"display_value": "76.92",
"delta": {
"value": 0,
"display_value": "0.00"
},
"has_score": true
}
}
ChangeSuccess - withSecurity(Boolean toggle)
Controls whether the method validates the user calling the associated method, ensuring that they have the rights to read the requested content.
- For the team success score: Checks that the user has read rights to the associated group.
- For model score: Checks that the user has read rights to the change model record.
- For type score: Checks that the user has read rights to the choice record for that change type.
| Name | Type | Description |
|---|---|---|
| toggle | Boolean | Flag that indicates whether to validate the user calling the associated
method. Valid values:
Default: true |
| Parameter | Description |
|---|---|
| None |
The following example shows how to turn the user security check off when calling the getScoresForChange() method.
var chgGr = new GlideRecord("change_request");
chgGr.get("number", "CHG0030305");
new sn_chg_score.ChangeSuccess().withSecurity(false).getScoresForChange(chgGr);
Output:
None
ChangeSuccess - withTeamScore(Boolean toggle)
Only valid when called with the getScoresForChange() method. Controls whether the getScoresForChange() method returns the team score. By default the team score is returned.
Use this method to toggle the return of this data on or off for the current ChangeSuccess object.
| Name | Type | Description |
|---|---|---|
| toggle | Boolean | Flag that indicates whether to include the team success score. Valid
values:
Default: true |
| Parameter | Description |
|---|---|
| team_success_score | Details on the team success score. Data type: Object |
| team_success_score.can_read | Flag that indicates whether a change team success score could be retrieved for the specified change request. Possible values:
Data type: Boolean |
| team_success_score.chg_success_score_rating | Individual objects for each field from the Change Success Score Rating [chg_success_score_rating] record that matches the returned score. Each field object has a key that is
the field name and contains value and display_value properties. If the field type is date/time, then the method also returns a display_value_internal
property which is in the user's timezone but in the system format YYYY-MM-DD HH24:MM:SS. Data type: Object |
| team_success_score.chg_success_score_rating.active | Flag that indicates whether the associated change success score record is active and available within the instance. Possible values:
Data type: Object |
| team_success_score.chg_success_score_rating.active.display_value | Display value for the active
flag. Data type: String |
| team_success_score.chg_success_score_rating.active.value | Internal value for the active flag. Data type: Boolean |
| team_success_score.chg_success_score_rating.color | Color of the associated change success score as shown in the Change Success Score Card for a change request. Data type: Object |
| team_success_score.chg_success_score_rating.color.display_value | Display value for color. Data type: String |
| team_success_score.chg_success_score_rating.color.value | Internal value for color. Data type: String |
| team_success_score.chg_success_score_rating.rating | Change success score rating, such as Low or High. Data type: Object |
| team_success_score.chg_success_score_rating.rating.display_value | Display value for rating. Data type: String |
| team_success_score.chg_success_score_rating.rating.value | Internal value for rating. Data type: String |
| team_success_score.chg_success_score_rating.score_end | Highest value in the change success score. Data type: Object |
| team_success_score.chg_success_score_rating.score_end.display_value | Display value for score_end. Data type: String |
| team_success_score.chg_success_score_rating.score_end.value | Internal value for score_end. Data type: Number |
| team_success_score.chg_success_score_rating.score_start | Lowest value in the change success score. Data type: Object |
| team_success_score.chg_success_score_rating.score_start.display_value | Display value for
score_start. Data type: String |
| team_success_score.chg_success_score_rating.score_start.value | Internal value for score_start. Data type: Number |
| team_success_score.chg_success_score_rating.sys_class_name | Change Success Score Rating table name. Always Change Success Score Rating/chg_success_score_rating. Data type: Object |
| team_success_score.chg_success_score_rating.sys_class_name.display_value | Display value for
sys_class_name. Data type: String |
| team_success_score.chg_success_score_rating.sys_class_name.value | Internal value for
sys_class_name. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_by | Name of the user that initially created the associated change success score rating record. Data type: Object |
| team_success_score.chg_success_score_rating.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_on | Date and time that the change success score rating record was originally created. Data type: Object |
| team_success_score.chg_success_score_rating.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_on.display_value_internal | Internal display value
for sys_created_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_domain | If using domains in the instance, the name of the domain to which the change success score record is associated. Data type: Object |
| team_success_score.chg_success_score_rating.sys_domain.display_value | Display value for sys_domain. Data type: String |
| team_success_score.chg_success_score_rating.sys_domain.value | Internal value for sys_domain. Data type: String |
| team_success_score.chg_success_score_rating.sys_id | Unique identifier of the associated change success score record. Data type: Object |
| team_success_score.chg_success_score_rating.sys_id.display_value | Display value for the sys_id. Data type: String |
| team_success_score.chg_success_score_rating.sys_id.value | Internal value for the sys_id. Data type: String |
| team_success_score.chg_success_score_rating.sys_mod_count | Number of times that the associated change success score record has been modified. Data type: Object |
| team_success_score.chg_success_score_rating.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| team_success_score.chg_success_score_rating.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| team_success_score.chg_success_score_rating.sys_name | Name of the change success score rating. Possible values:
Data type: Object |
| team_success_score.chg_success_score_rating.sys_name.display_value | Display value for sys_name. Data type: String |
| team_success_score.chg_success_score_rating.sys_name.value | Internal value for sys_name. Data type: String |
| team_success_score.chg_success_score_rating.sys_overrides | Sys_id of a record in the same table but in a domain above that of the current record. This allows a record in a lower domain to override a record in a domain above it. For example, if you have a rating record defined in the "global" domain but for domain "TOP/ACME" you override the record in "global". Data type: Object |
| team_success_score.chg_success_score_rating.sys_overrides.display_value | Display value for
sys_overrides. Data type: String |
| team_success_score.chg_success_score_rating.sys_overrides.value | Internal value for sys_overrides. Data type: String |
| team_success_score.chg_success_score_rating.sys_tags | List of system tags associated with the change success score record. Data type: Object |
| team_success_score.chg_success_score_rating.sys_tags.display_value | Display value for sys_tags. Data type: String |
| team_success_score.chg_success_score_rating.sys_tags.value | Internal value for sys_tags. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_by | Name of the user that last updated the associated change success score record. Data type: Object |
| team_success_score.chg_success_score_rating.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_on | Date and time the associated change success score record was last updated. Data type: Object |
| team_success_score.chg_success_score_rating.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_on.display_value_internal | Internal display value
for sys_updated_on. Data type: String |
| team_success_score.chg_success_score_rating.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
| team_success_score.score | Details about the returned score indicator. Data type: Object |
| team_success_score.score.delta | Change in the score from the previous score. Data type: Object |
| team_success_score.score.delta.display_value | Display value for delta. Data type: String |
| team_success_score.score.delta.value | Internal value for delta. Data type: String |
| team_success_score.score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| team_success_score.score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| team_success_score.score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| team_success_score.score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| team_success_score.score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| team_success_score.score.value | Value returned by PA for the success score. Data type: String |
| team_success_score.sys_user_group | Individual objects for each field from the
Group [sys_user_group] record referenced by the specified change request. Each field
object has a key that is the field name and contains value and
display_value properties. If the field type is date/time,
then the method also returns a display_value_internal property
which is in the user's timezone but in the system format YYYY-MM-DD HH24:MM:SS. Data
type: Object |
| team_success_score.sys_user_group.active | Flag that indicates whether the group is active. Possible values:
Data type: Object |
| team_success_score.sys_user_group.active.display_value | Display value for the
active flag. Data type: String |
| team_success_score.sys_user_group.active.value | Internal value for the active
flag. Data type: Boolean |
| team_success_score.sys_user_group.cost_center | Sys_id of the cost center associated with the group. Data type: Object |
| team_success_score.sys_user_group.cost_center.display_value | Display value for
cost_center. Data type: String |
| team_success_score.sys_user_group.cost_center.value | Internal value for
cost_center. Data type: String |
| team_success_score.sys_user_group.default_assignee | Sys_id of the user that is the default assignee of the group. Data type: Object |
| team_success_score.sys_user_group.default_assignee.display_value | Display value
for default_assignee. Data type: String |
| team_success_score.sys_user_group.default_assignee.value | Internal value for
default_assignee. Data type: String |
| team_success_score.sys_user_group.description | Description of the group Data type: Object |
| team_success_score.sys_user_group.description.display_value | Display value for
description. Data type: String |
| team_success_score.sys_user_group.description.value | Internal value for
description. Data type: String |
| team_success_score.sys_user_group.email | Email address for the group. Data type: Object |
| team_success_score.sys_user_group.email.display_value | Display value for
email. Data type: String |
| team_success_score.sys_user_group.email.value | Internal value for email. Data type: String |
| team_success_score.sys_user_group.exclude_manager | Flag that indicates whether the manager of the group receives group emails. Possible values:
Data type: Object |
| team_success_score.sys_user_group.exclude_manager.display_value | Display value
for exclude_manager. Data type: String |
| team_success_score.sys_user_group.exclude_manager.value | Internal value for
exclude_manager. Data type: Boolean |
| team_success_score.sys_user_group.include_members | Flag that indicates whether the group members receive individual emails when someone sends an email to the group email address. The only exception to this functionality
is for approval notifications, whereby all members of a group receive an approval notification, regardless of this selection. Valid values:
Data type: Object |
| team_success_score.sys_user_group.include_members.display_value | Display value
for include_members. Data type: String |
| team_success_score.sys_user_group.include_members.value | Internal value for
include_members. Data type: Boolean |
| team_success_score.sys_user_group.manager | Sys_id of the manager of the group. Data type: Object |
| team_success_score.sys_user_group.manager.display_value | Display value for
manager. Data type: String |
| team_success_score.sys_user_group.manager.value | Internal value for
manager. Data type: String |
| team_success_score.sys_user_group.name | Name of the group. Data type: Object |
| team_success_score.sys_user_group.name.display_value | Display value for
name. Data type: String |
| team_success_score.sys_user_group.name.value | Internal value for name. Data type: String |
| team_success_score.sys_user_group.parent | Sys_id of the parent of this group. If a group has a parent, the child group inherits the roles of the parent group. The members of the child group are not members of the parent
group. For example, if an incident is assigned to the parent group and you click the Assigned to lookup icon, only the members in the parent group are available. The members of the child group are not available. Data type: Object |
| team_success_score.sys_user_group.parent.display_value | Display value for
parent. Data type: String |
| team_success_score.sys_user_group.parent.value | Internal value for parent. Data type: String |
| team_success_score.sys_user_group.roles | User roles assigned to the group. Data type: Object |
| team_success_score.sys_user_group.roles.display_value | Display value for
roles. Data type: String |
| team_success_score.sys_user_group.roles.value | Internal value for roles. Data type: String |
| team_success_score.sys_user_group.source | Source of the group. Data type: Object |
| team_success_score.sys_user_group.source.display_value | Display value for
source. Data type: String |
| team_success_score.sys_user_group.source.value | Internal value for source. Data type: String |
| team_success_score.sys_user_group.sys_created_by | User that created the group record. Data type: Object |
| team_success_score.sys_user_group.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| team_success_score.sys_user_group.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| team_success_score.sys_user_group.sys_created_on | Date and time that the group record was originally created. Data type: Object |
| team_success_score.sys_user_group.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| team_success_score.sys_user_group.sys_created_on.display_value_internal | Internal
display value for sys_created_on. Data type: String |
| team_success_score.sys_user_group.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| team_success_score.sys_user_group.sys_id | Sys_id for the group. Data type: Object |
| team_success_score.sys_user_group.sys_id.display_value | Display value for
sys_id. Data type: String |
| team_success_score.sys_user_group.sys_id.value | Internal value for sys_id. Data type: String |
| team_success_score.sys_user_group.sys_mod_count | Number of times that the associated group information has been modified. Data type: Object |
| team_success_score.sys_user_group.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| team_success_score.sys_user_group.sys_mod_count.value | Internal value for
sys_mod_count. Data type: Number |
| team_success_score.sys_user_group.sys_updated_by | User that last updated the group information. Data type: Object |
| team_success_score.sys_user_group.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| team_success_score.sys_user_group.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| team_success_score.sys_user_group.sys_updated_on | Date and time when the group information was last updated. Data type: Object |
| team_success_score.sys_user_group.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| team_success_score.sys_user_group.sys_updated_on.display_value_internal | Internal
display value for sys_updated_on. Data type: String |
| team_success_score.sys_user_group.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
| team_success_score.sys_user_group.type | Type of group. Data type: Object |
| team_success_score.sys_user_group.type.display_value | Display value for
type. Data type: String |
| team_success_score.sys_user_group.type.value | Internal value for type. Data type: String |
The following code example shows how to use this method to set the team score return response to false.
var chgGr = new GlideRecord("change_request");
chgGr.get("number", "CHG0030305");
gs.info(JSON.stringify(new sn_chg_score.ChangeSuccess().withTeamScore(false).getScoresForChange(chgGr), null, 2));
The following output only shows the team score values that are returned if this helper is set to true. To see the other scores that may be returned, see getScoresForChange().
{
"team_success_score": {
"can_read": true,
"sys_user_group": {
"parent": {
"display_value": "",
"value": ""
},
"manager": {
"display_value": "",
"value": ""
},
"roles": {
"display_value": "",
"value": ""
},
"sys_mod_count": {
"display_value": "0",
"value": 0
},
"description": {
"display_value": "",
"value": ""
},
"active": {
"display_value": "true",
"value": true
},
"source": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2018-03-07 21:00:41",
"value": "2018-03-07 21:00:41",
"display_value_internal": "2018-03-07 21:00:41"
},
"type": {
"display_value": "",
"value": ""
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_id": {
"display_value": "5f6441efc0a8010e0177fcb589156352",
"value": "5f6441efc0a8010e0177fcb589156352"
},
"sys_updated_by": {
"display_value": "glide.maint",
"value": "glide.maint"
},
"cost_center": {
"display_value": "",
"value": ""
},
"default_assignee": {
"display_value": "",
"value": ""
},
"sys_created_on": {
"display_value": "2018-03-07 21:00:41",
"value": "2018-03-07 21:00:41",
"display_value_internal": "2018-03-07 21:00:41"
},
"name": {
"display_value": "IT Securities",
"value": "IT Securities"
},
"exclude_manager": {
"display_value": "false",
"value": false
},
"email": {
"display_value": "",
"value": ""
},
"include_members": {
"display_value": "false",
"value": false
},
"sys_created_by": {
"display_value": "glide.maint",
"value": "glide.maint"
}
},
"score": {
"indicator": {
"name": "Change success scores",
"sys_id": "0ff316e173081010491d235f04f6a758"
},
"value": 465,
"display_value": "465",
"delta": {
"value": 0,
"display_value": "0"
},
"has_score": true
},
"chg_success_score_rating": {
"score_start": {
"display_value": "0",
"value": 0
},
"score_end": {
"display_value": "499",
"value": 499
},
"color": {
"display_value": "#FCCAC9",
"value": "#FCCAC9"
},
"rating": {
"display_value": "Low",
"value": "Low"
},
"sys_mod_count": {
"display_value": "0",
"value": 0
},
"active": {
"display_value": "true",
"value": true
},
"sys_overrides": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2020-03-27 07:43:29",
"value": "2020-03-27 07:43:29",
"display_value_internal": "2020-03-27 07:43:29"
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_class_name": {
"display_value": "Change Success Score Rating",
"value": "chg_success_score_rating"
},
"sys_id": {
"display_value": "7ad380b573330010491d235f04f6a717",
"value": "7ad380b573330010491d235f04f6a717"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"sys_created_on": {
"display_value": "2020-03-27 07:43:29",
"value": "2020-03-27 07:43:29",
"display_value_internal": "2020-03-27 07:43:29"
},
"sys_domain": {
"display_value": "global",
"value": "global"
},
"sys_name": {
"display_value": "Low",
"value": "Low"
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
}
}
}
ChangeSuccess - withTeamScoreRatings(Boolean toggle)
Controls whether the associated method returns the details for all change success score rating records. By default, this information is not returned.
| Name | Type | Description |
|---|---|---|
| toggle | Boolean | Flag that indicates whether to include the details for all team success score
rating records. Valid values:
Default: false |
| Parameter | Description |
|---|---|
| ratings | |
| ratings.active | Flag that indicates whether the associated change success score record is active and available within the instance. Possible values:
Data type: Object |
| ratings.active.display_value | Display value for the active
flag. Data type: String |
| ratings.active.value | Internal value for the active flag. Data type: Boolean |
| ratings.color | Color of the associated change success score as shown in the Change Success Score Card for a change request. Data type: Object |
| ratings.color.display_value | Display value for color. Data type: String |
| ratings.color.value | Internal value for color. Data type: String |
| ratings.rating | Change success score rating, such as Low or High. Data type: Object |
| ratings.rating.display_value | Display value for rating. Data type: String |
| ratings.rating.value | Internal value for rating. Data type: String |
| ratings.score_end | Highest value in the change success score. Data type: Object |
| ratings.score_end.display_value | Display value for score_end. Data type: String |
| ratings.score_end.value | Internal value for score_end. Data type: Number |
| ratings.score_start | Lowest value in the change success score. Data type: Object |
| ratings.score_start.display_value | Display value for
score_start. Data type: String |
| ratings.score_start.value | Internal value for score_start. Data type: Number |
| ratings.sys_class_name | Change Success Score Rating table name. Always Change Success Score Rating/chg_success_score_rating. Data type: Object |
| ratings.sys_class_name.display_value | Display value for
sys_class_name. Data type: String |
| ratings.sys_class_name.value | Internal value for
sys_class_name. Data type: String |
| ratings.sys_created_by | Name of the user that initially created the associated change success score rating record. Data type: Object |
| ratings.sys_created_by.display_value | Display value for
sys_created_by. Data type: String |
| ratings.sys_created_by.value | Internal value for
sys_created_by. Data type: String |
| ratings.sys_created_on | Date and time that the change success score rating record was originally created. Data type: Object |
| ratings.sys_created_on.display_value | Display value for
sys_created_on. Data type: String |
| ratings.sys_created_on.display_value_internal | Internal display value
for sys_created_on. Data type: String |
| ratings.sys_created_on.value | Internal value for
sys_created_on. Data type: String |
| ratings.sys_domain | If using domains in the instance, the name of the domain to which the change success score record is associated. Data type: Object |
| ratings.sys_domain.display_value | Display value for sys_domain. Data type: String |
| ratings.sys_domain.value | Internal value for sys_domain. Data type: String |
| ratings.sys_id | Unique identifier of the associated change success score record. Data type: Object |
| ratings.sys_id.display_value | Display value for the sys_id. Data type: String |
| ratings.sys_id.value | Internal value for the sys_id. Data type: String |
| ratings.sys_mod_count | Number of times that the associated change success score record has been modified. Data type: Object |
| ratings.sys_mod_count.display_value | Display value for
sys_mod_count. Data type: String |
| ratings.sys_mod_count.value | Internal value for sys_mod_count. Data type: Number |
| ratings.sys_name | Name of the change success score rating. Possible values:
Data type: Object |
| ratings.sys_name.display_value | Display value for sys_name. Data type: String |
| ratings.sys_name.value | Internal value for sys_name. Data type: String |
| ratings.sys_overrides | Sys_id of a record in the same table but in a domain above that of the current record. This allows a record in a lower domain to override a record in a domain above it. For example, if you have a rating record defined in the "global" domain but for domain "TOP/ACME" you override the record in "global". Data type: Object |
| ratings.sys_overrides.display_value | Display value for
sys_overrides. Data type: String |
| ratings.sys_overrides.value | Internal value for sys_overrides. Data type: String |
| ratings.sys_tags | List of system tags associated with the change success score record. Data type: Object |
| ratings.sys_tags.display_value | Display value for sys_tags. Data type: String |
| ratings.sys_tags.value | Internal value for sys_tags. Data type: String |
| ratings.sys_updated_by | Name of the user that last updated the associated change success score record. Data type: Object |
| ratings.sys_updated_by.display_value | Display value for
sys_updated_by. Data type: String |
| ratings.sys_updated_by.value | Internal value for
sys_updated_by. Data type: String |
| ratings.sys_updated_on | Date and time the associated change success score record was last updated. Data type: Object |
| ratings.sys_updated_on.display_value | Display value for
sys_updated_on. Data type: String |
| ratings.sys_updated_on.display_value_internal | Internal display value
for sys_updated_on. Data type: String |
| ratings.sys_updated_on.value | Internal value for
sys_updated_on. Data type: String |
The following code example shows how to use this method to set the team score rating return response to false.
var chgGr = new GlideRecord("change_request");
chgGr.get("number", "CHG0030305");
gs.info(JSON.stringify(new sn_chg_score.ChangeSuccess().withTeamScoreRatings(false).getTeamScoreForChange(chgGr), null, 2));
The following output only shows the team score values that are returned if this helper is set to true. To see the other scores that may be returned, refer to the method to which you are associating this helper.
"ratings": [
{
"score_start": {
"display_value": "700",
"value": 700
},
"score_end": {
"display_value": "850",
"value": 850
},
"color": {
"display_value": "#A4EDA8",
"value": "#A4EDA8"
},
"rating": {
"display_value": "Excellent",
"value": "Excellent"
},
"sys_mod_count": {
"display_value": "1",
"value": 1
},
"active": {
"display_value": "true",
"value": true
},
"sys_overrides": {
"display_value": "",
"value": ""
},
"sys_updated_on": {
"display_value": "2020-03-27 07:45:36",
"value": "2020-03-27 07:45:36",
"display_value_internal": "2020-03-27 07:45:36"
},
"sys_tags": {
"display_value": "",
"value": ""
},
"sys_class_name": {
"display_value": "Change Success Score Rating",
"value": "chg_success_score_rating"
},
"sys_id": {
"display_value": "76e440fd73330010491d235f04f6a7df",
"value": "76e440fd73330010491d235f04f6a7df"
},
"sys_updated_by": {
"display_value": "admin",
"value": "admin"
},
"sys_created_on": {
"display_value": "2020-03-27 07:44:46",
"value": "2020-03-27 07:44:46",
"display_value_internal": "2020-03-27 07:44:46"
},
"sys_domain": {
"display_value": "global",
"value": "global"
},
"sys_name": {
"display_value": "Excellent",
"value": "Excellent"
},
"sys_created_by": {
"display_value": "admin",
"value": "admin"
}
}
]
ChangeSuccess - withTypeScore(Boolean toggle)
Only valid when called with the getScoresForChange() method. Controls whether the getScoresForChange() method returns the type score. By default the type score is returned.
Use this method to toggle the return of this data on or off for the current ChangeSuccess object.
| Name | Type | Description |
|---|---|---|
| toggle | Boolean | Flag that indicates whether to include the type success score. Valid
values:
Default: true |
| Parameter | Description |
|---|---|
| type_success_score | Details about the type success score. Data type: Object |
| type_success_score.can_read | Flag that indicates whether a type success score
could be retrieved for the specified change request. Valid values:
Data type: Boolean |
| type_success_score.score | Details about the returned score indicator. Data type: Object |
| type_success_score.score.delta | Change in the score from the previous score. Data type: Object |
| type_success_score.score.delta.display_value | Display value for delta. Data type: String |
| type_success_score.score.delta.value | Internal value for delta. Data type: String |
| type_success_score.score.display_value | Display value returned by Performance Analytics (PA). Data type: String |
| type_success_score.score.has_score | Flag that indicates whether a score was returned for the specified change request. Possible values:
Data type: Boolean |
| type_success_score.score.indicator | Additional details on the PA indicator used to obtain the score. Data type: Object |
| type_success_score.score.indicator.name | Name of the PA indicator used to obtain the score. Data type: String |
| type_success_score.score.indicator.sys_id | Sys_id of the PA indicator used to obtain the score. Data type: String |
| type_success_score.score.value | Value returned by PA for the success score. Data type: String |
| type_success_score.type | Details about the type success score. Data type: Object |
| type_success_score.type.display_value | Label of the choice. Data type: String |
| type_success_score.type.sys_id | Sys_id of the Choice [sys_choice] record for the
specified change type. Data type: String |
| type_success_score.type.value | Value of the choice. Data type: String |
The following code example shows how to use this method to set the desired type score return response.
var chgGr = new GlideRecord("change_request");
chgGr.get("number", "CHG0030305");
gs.info(JSON.stringify(new sn_chg_score.ChangeSuccess().withTypeScore(true).getScoresForChange(chgGr), null, 2));
The following output only shows the type success score values that are returned if this helper is set to true. To see the other scores that may be returned, see getScoresForChange().
"type_success_score": {
"can_read": true,
"type": {
"sys_id": "e7a27d53cb100200d71cb9c0c24c9c2f",
"value": "normal",
"display_value": "Normal"
},
"score": {
"indicator": {
"name": "Change Type: % Successful and Successful With Issues",
"sys_id": "f9d25995c3ce011005aea539e540ddee"
},
"value": null,
"display_value": "",
"delta": {
"value": "0",
"display_value": ""
},
"has_score": false
}
}