On classification script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi Gents
I hope for all reading users a great 2026!
I post this mine in order to have a quick help on the feature called "On classification script" (https://www.servicenow.com/docs/bundle/zurich-it-operations-management/page/product/discovery/refere...
For me it's not so clear what it means when the article explains "current":
| current | Points to a JavaScript object with its [property:value] pair to update the application record. (It is not an actual GlideRecord object of the application.) |
I'm sure that I obtained some cases where - despite to the correct applying code as indicated in the page (e.g. current.name = processClassiferName + "999" + "@" + computerName;), the name field of the application CI didn't change. And I'm sure that, in my custom process classification record, I used current.short_description = "REY-WILDFLY" and the Description field of the application CI changed as expected.
If I waste my time reading some AI pages (e.g. ChatGPT or similar), it seems that it's a feature "bad documented" and it should be possible to set all attributes of the running process record and, reflexively, the attributes of the application CI.
In short words, another case of "obscure Service Now configuration".
Then I preferred asking here if there is someone having any experience in that part of the platform, some code to exchange, some clues or results or hypothesis to share.....
At the moment my feeling is that the feature is used, also in the OOTB; but it's very unclear -
at least for me:
- when it acts in the Discovery Process (I suppose during the last phase, 4, application exploration),
- how to use it (it seems better to use with probes/sensors but it's not indicated in official doc)
and, finally,
- how it interacts with other pieces (Patterns, Pattern Pre/Post Scripts)
All contributions to this post are welcome!
My goal is to change the description of the application CI (cmdb_ci_appl) without using the pattern/custom pattern; the change of that field is related to a server logic (business rule) in order to run a custom logic.
A big hug to everyone
Davide Gandolfi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
You are correct we used that script in the probe and sensor days to to do various things like setting the name of a MSSQL instance for example, the use case you are citing. It provided alot of capability and was never considered "obscure" it helped us do things to the current record without having to extend the probes. However with the implementation of patterns we manage the name there so that would be "ignored" if the pattern completed successfully.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Thank you for the response, doug_schulze
Then, if I'm understanding well, the Pattern could overwrite or take precedence on the on classification script?
If this is true, do you think that I have to look for all steps on the related Pattern in order to find out if there is one where my short_description is there? Taking a quick look of the discovery logs it seems no.....
Thank you for the sharing of your experience
Cheers
Davide Gandolfi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Gents,
I update here because - thank @doug_schulze , I take a bit in order to understand the statement "However with the implementation of patterns we manage the name there so that would be "ignored" if the pattern completed successfully. ". I demostrated that:
- If you use the On Classification Script on a Process Classification without any Discovery Pattern linked to, it the name takes the format <Process Classification>@<Host> and it's possibile to use current.short_description to set the Description field of the Appl CI.
- If you add onto the same Process Classification with the On Classification Script working fine, a Discovery Pattern, that fact overwrites some fields of the Appl CI. The name becames the class name of the CI ("Application Server" instead of the "Rapid@MyHost" obtained to point 1), and current.short_description stops to work. The Discovery Pattern obviously MUST to be "all green" or it executes and completes successfully.
- If you remove again the linked Discovery Pattern, voila: the name returns to the format ("Rapid@MyHost") and the current.short_description works again.
Based on these evidences, for me, it's clear that the On Classification Script can affect the Application CI fields if and only if you don't use Discovery Pattern (Horizontal Probe).
