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.
Parent Topic:Server API reference
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: - true: Model success score was retrieved. - false: Model success score wasn't retrieved. 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. |
| chg\_model.active | Flag that indicates whether the associated change model record is active and available within the instance.Possible values: - true: Change model is active. - false: Change model isn't active. 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: - true: Advanced security is used. - false: Advanced security isn't used. 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: - true: Change model is available in the user interface. - false: Change model isn't available in the user interface. 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: - true: Default - false: Not the default 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: `"type=normal^assignment_group=a715cd759f2002002920bde8132e7018^short_description=Automated : Change^EQ"` 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: - true: Score was returned. - false: No score was returned. 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: - true: Model success score was retrieved. - false: Model success score wasn't retrieved. 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. |
| chg\_model.active | Flag that indicates whether the associated change model record is active and available within the instance.Possible values: - true: Change model is active. - false: Change model isn't active. 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: - true: Advanced security is used. - false: Advanced security isn't used. 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: - true: Change model is available in the user interface. - false: Change model isn't available in the user interface. 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: - true: Default - false: Not the default 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: `"type=normal^assignment_group=a715cd759f2002002920bde8132e7018^short_description=Automated : Change^EQ"` 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: - true: Score was returned. - false: No score was returned. 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": Boolean, "chg_model": {Object}, "score": {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: - true: Team success score was retrieved. - false: Team success score wasn't retrieved. 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: - true: Change success score record is active. - false: Change success score record isn't active. 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: - Excellent - High - Low - Medium 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: - true: Score was returned. - false: No score was returned. 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: - true: Group is active - false: Group is de-activated 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 groupData 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: - true: Manager doesn't receive group emails. - false: Manager receives group emails. 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: - true: Send emails to the entire group. - false: Only send emails to the default\_assignee. 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": Boolean, "score": {Object}, "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: - true: Team success score was retrieved. - false: Team success score wasn't retrieved. 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: - true: Change success score record is active. - false: Change success score record isn't active. 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: - Excellent - High - Low - Medium 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: - true: Score was returned. - false: No score was returned. 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: - true: Group is active - false: Group is de-activated 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 groupData 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: - true: Manager doesn't receive group emails. - false: Manager receives group emails. 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: - true: Send emails to the entire group. - false: Only send emails to the default\_assignee. 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: - true: Team success score was retrieved. - false: Team success score wasn't retrieved. 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: - true: Change success score record is active. - false: Change success score record isn't active. 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: - Excellent - High - Low - Medium 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: - true: Score was returned. - false: No score was returned. 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: - true: Group is active - false: Group is de-activated 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 groupData 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: - true: Manager doesn't receive group emails. - false: Manager receives group emails. 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: - true: Send emails to the entire group. - false: Only send emails to the default\_assignee. 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: - true: Type success score was retrieved. - false: Type success score was not retrieved. 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: - true: Score was returned. - false: No score was returned. 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": "String", "sys_id": "String", "value": "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 |
| 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.
Use this method to toggle the return of this data on or off for the current ChangeSuccess object. This method is a helper method and must be used in conjunction with one of the other methods that return a success score such as:
- ChangeSuccess - getScoresForChange(Object chgGr)
- ChangeSuccess - getTeamScoreForChange(Object chgGr)
- ChangeSuccess - getModelScoreForModelId(String sys_id, String domain_id)
| Name | Type | Description |
|---|---|---|
| toggle | Boolean | Flag that indicates whether to include the details of the PA indicators.Valid values: - true: Return the details of the PA indicators. - false: Do not return the details of the PA indicators. 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: - true: Score was returned. - false: No score was returned. 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: - true: Return the model success score. - false: Do not return the model success score. Default: true |
| Parameter | Description |
|---|---|
| model\_success\_score | Details on the model success score.Data type: Object ``` "model_success_score" { "can_read": Boolean, "chg_model": {Object}, "score": {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: - true: Team success score was retrieved. - false: Team success score wasn't retrieved. 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: - true: Change success score record is active. - false: Change success score record isn't active. 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: - Excellent - High - Low - Medium 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: - true: Score was returned. - false: No score was returned. 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: - true: Group is active - false: Group is de-activated 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 groupData 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: - true: Manager doesn't receive group emails. - false: Manager receives group emails. 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: - true: Send emails to the entire group. - false: Only send emails to the default\_assignee. 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.
Use this method to toggle the return of this data on or off for the current ChangeSuccess object. This method is a helper method and must be used in conjunction with one of the other methods that return a success score such as:
- ChangeSuccess - getScoresForChange(Object chgGr)
- ChangeSuccess - getTeamScoreForChange(Object chgGr)
- ChangeSuccess - getModelScoreForModelId(String sys_id, String domain_id)
| Name | Type | Description |
|---|---|---|
| toggle | Boolean | Flag that indicates whether to include the details for all team success score rating records.Valid values: - true: Return the details for all change success score rating records. - false: Do not return the details for all change success score rating records. 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: - true: Change success score record is active. - false: Change success score record isn't active. 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: - Excellent - High - Low - Medium 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: - true: Return the type success score. - false: Do not return the type success score. Default: true |
| Parameter | Description |
|---|---|
| type\_success\_score | Details about the type success score.Data type: Object ``` "type_success_score": { "can_read": Boolean, "score": {Object}, "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
}
}