«Item Diagnostic» UI Action

11. Mai 2023Jacqueline Batt

The "Item Diagnostic" UI Action is used to do a health check of a Catalog Item, based on ServiceNow best practice recommendations. For example, the usage of GlideRecord in Catalog client script or using entitlements different than User Criteria, are considered violation of best practice, and they will be highlighted when executing the UI Item Diagnostic.

The rules for the health check, including the score given when a rule is breached (Weight), are defined in the diagnostic_rule table. However, in that table we do not define the logic of the rules but we only list their names, while the real logic/script is defined in the CatalogItemDiagnosticScore script include. For every Diagnostic Rule defined in the relevant table, there is an equivalent function in the script include, where the logic of the rule is defined.

The way the Item Diagnostic works is that once you click the UI Action, the script include CatalogItemDiagnosticScore is initiate, by giving it the cat_item sys_id, and its method "processItem" is called. The script include then searches in the Diagnostic Rule table, and for each rule it calls the relevant method.

Here the list of the standard OOB rules:

  • checkBalancedContainers (it checks that for each containerStart there is an equivalent containerEnd)
  • checkDuplicateVariables
  • checkAJAX (This searches both for AJAX calls but also for GlideRecord calls to avoid not best practices client-server calls)
  • checkDOMManipulation
  • checkSelectBoxUnique
  • checkUserCriteriaUsage
  • checkOrderGuideRuleBaseCount (Checks for high number of active rule bases in an Order Guide as higher number of rule bases can potentially lead to slower load times)
  • checkLookupVariableRowCount
  • checkFormatterVariablesUsage (Checks if the item has the following variable types:
    1. Macro
    2. Macro with label
    3. UI Page variable type)

Being the logic defined in the Script Include, it is also possible to enhance this feature and add more Rules in the Item Diagnostic.

For example it can be very useful to have a rule that checks if catalog ui policies, ui policies actions & clients scripts of a catalog item are referencing to variables that do not exist in catalog item, maybe because it had previously deleted.

Another simple Rule could be to check whether the Item has at least a Workflow or a Flow (or an execution plan?), linked to it.

Or perhaps a rule to verify that an item has short description and description, and that the Icon and Picture, if defined, are not corrupted/missing. This happens sometimes when moving between environments.

All of the above could be achieved by defining the rule in the Diagnostic Rule table, and then writing the relevant script in the above mentioned Script Include.

ServiceNow also provide a Diagnostic Result Report, which gives an overview of Catalog Items that have been marked as containing violations of the recommendations. The report can be accessed from the Request Reports menu under Service Catalog -->Catalog Administration.

Möchten Sie mehr über die spannenden Funktionen und Erweiterungen in ServiceNow erfahren? Lassen Sie sich von uns begeistern! Kontaktieren Sie uns noch heute unter kntktprzssfxcm, und unser engagiertes Prozessfux-Team steht Ihnen gerne zur Verfügung. Entdecken Sie gemeinsam mit uns, wie ServiceNow Ihr Unternehmen auf ein neues Level heben kann.

Herzliche Grüsse,
Ihr Prozessfux Team!

Prozessfux Related Links
Prozessfux Related Links

The UI Action is available under the Related Links in every Catalog Item.

Feedbacks

Diese Webseite verwendet Cookies. Durch die Nutzung der Webseite stimmen Sie der Verwendung von Cookies zu. Datenschutzinformationen