This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Testing the CMDB Class of some made up hosts on my instance | |
| //Positive Test | |
| var NotThere = 'b69715668326e110b356df647daad3f8';//cmdb_ci_vm_object | |
| var chrisOne = '5f7dfd9cc0a8010e00ab58006f14bdc5';//cmdb_ci_unix_server | |
| var answer = false; | |
| var rec = new GlideRecord('cmdb_ci'); | |
| rec.get(chrisOne); | |
| //test = 'manufacturer=b7e7c073c0a801690143e7b7d29eb408'; //Works | |
| //test = 'sys_class_name=cmdb_ci_unix_server'; //Works | |
| //test = 'sys_class_nameINSTANCEOFcmdb_ci_unix_server'; //Works |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| GlideOverlay() only works with certin pages like UI Pages(?) | |
| It's not documented so... | |
| Note for the survey part | |
| IMPORTANT: | |
| - The Assessments "Metric type" must match when you build the URL | |
| - The Assessment need to be Ready to take and NOT expired | |
| */ | |
| function pop() { | |
| //GlideDialogWindow.get().destroy(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| You want to use the 'Host' name in the cmdb_ci 'Name' field for a future SN Discovery match via IRE | |
| Done for each scaner source(Qualys, Tenable, etc) | |
| This ONLY applies to the 'Target Name' Field | |
| Typicaly need to transform FQDN/DNS into just it's Host component | |
| Host Import Map [sn_sec_cmn_src_cmdb_map | |
| Use Script = true | |
| */ | |
| //Expecting an FQDN | |
| answer = value;//Default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| A VR scanner may "reopen" a "closed" VIT that has an Active Deferral... so stop that from happening | |
| BR on sn_vul_vulnerable_item | |
| When: Before - Update | |
| Condition: State changes to Open | |
| */ | |
| var date = new GlideDate(); | |
| var current_date = date.getByFormat('yyyy-MM-dd'); | |
| //This is a 'light' check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| UI Action | |
| Action name:reopen_incident | |
| Client: True | |
| Onclick: reopen() | |
| https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1005843 | |
| Note: | |
| - getFormElement() - Returns the HTML element for the form. | |
| - gsftSubmit() | |
| -- Pass a control (button) or a form and action name if the control does not exist. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This CI Lookup Rule is forcing a match for testing. | |
| Set a filter on you System Log -> All: Message Starts with CCLR: | |
| For example, if you want to test CI Promotion. | |
| Setup a CI Lookup Rule: | |
| Name: CUSTOM, Order: 1, Lookup Method: Script, Type: Custom, Active: True | |
| Source: <The Souce needs to match the same source that you will be testing> Example: Tenable.io | |
| Source field: <match a Discovered Item payload field name ***exactly****> Example: IP_ADDRESSES | |
| Test Data: This sample data comes with a Development System |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/no-namespace/c_GlideRecordScopedAPI#r_ScopedGlideRecordUpdateMultiple?navFilter=updatem | |
| So... for VR and CC *** DON'T *** use updateMultiple(). | |
| Why? Becouse: | |
| (1) On Audited tables it acts more like a glide query and does it one at a time with all the overhead | |
| (2) >5000 records seesm to be hard on the Node, so be nice to your Nodes ;) | |
| 3/24/2023 -- True today, but if you are reading this years from now... things might have changed... | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| There is a Field Type called "UI Action List" which displays a Link in a Field. Clicking on the Link, calls a UI Action. | |
| The is a "complete" example on how to put this together. | |
| */ | |
| //Step One: Unhide the "UI Action List" Field Type | |
| var item = '355be32bbfa00100421cdc2ecf073929';//UI Action List / glide_action_list | |
| var gr = new GlideRecord('sys_glide_object'); | |
| gr.get(item); | |
| gr.setValue('visible',true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Unclassed Hardware [cmdb_ci_unclassed_hardware] | |
| Transform FQDN to Short Name in CI Name[name] Field | |
| The IRE relies on the Hardware CI Name field for a match | |
| SN Discovery uses the Short Host Name and VR Scanners sometime just use FQDNs | |
| */ | |
| /* | |
| Script One: Host Import Maps [sn_sec_cmn_src_cmdb_map.list] | |
| For records that have a Target Field of 'Name' and a Source Field like DNS,FQDN, etc |