Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2da9254
script.js
trimbakeshmadhan-109 Oct 27, 2025
c9315ec
README.md
trimbakeshmadhan-109 Oct 27, 2025
5d17de8
Script.js
trimbakeshmadhan-109 Oct 27, 2025
c8c2e06
README.md
trimbakeshmadhan-109 Oct 27, 2025
14244d8
script.js
trimbakeshmadhan-109 Oct 27, 2025
45c645d
README.md
trimbakeshmadhan-109 Oct 27, 2025
3edf0bc
Update README.md
trimbakeshmadhan-109 Oct 27, 2025
fa78c36
script.js
trimbakeshmadhan-109 Oct 27, 2025
a6e23bd
README.md
trimbakeshmadhan-109 Oct 27, 2025
484bcdd
Update script.js
trimbakeshmadhan-109 Oct 27, 2025
12f9ba9
Delete Core ServiceNow APIs/GlideAggregate/Count Inactive Users with …
trimbakeshmadhan-109 Oct 28, 2025
23f8bb3
Delete Core ServiceNow APIs/GlideAggregate/Count Inactive Users with …
trimbakeshmadhan-109 Oct 28, 2025
75d8c0b
Delete Core ServiceNow APIs/GlideAggregate/Find oldest Incident based…
trimbakeshmadhan-109 Oct 28, 2025
4f13513
Delete Core ServiceNow APIs/GlideAggregate/Find oldest Incident based…
trimbakeshmadhan-109 Oct 28, 2025
5328dda
Delete Core ServiceNow APIs/GlideJsonPath/GlideJsonPath Reader Exampl…
trimbakeshmadhan-109 Oct 28, 2025
6750b61
Delete Core ServiceNow APIs/GlideJsonPath/GlideJsonPath Reader Exampl…
trimbakeshmadhan-109 Oct 28, 2025
12a0fed
Script.js
trimbakeshmadhan-109 Oct 28, 2025
df1f0eb
Create README.md
trimbakeshmadhan-109 Oct 28, 2025
c12018d
Delete Core ServiceNow APIs/GlideAggregate/Create Problem based on in…
trimbakeshmadhan-109 Oct 28, 2025
37c6fa8
Delete Core ServiceNow APIs/GlideAggregate/Create Problem based on in…
trimbakeshmadhan-109 Oct 28, 2025
5e295b6
script.js
trimbakeshmadhan-109 Oct 28, 2025
6df8ce2
Create README.md
trimbakeshmadhan-109 Oct 28, 2025
d74abdc
Delete Server-Side Components/Background Scripts/Remmediate Licensing…
trimbakeshmadhan-109 Oct 28, 2025
9307539
Delete Server-Side Components/Background Scripts/Remmediate Licensing…
trimbakeshmadhan-109 Oct 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Remmediate Licensing for non - Licensable Software Installs

This repository contains a ServiceNow server-side script designed for a data cleanup operation related to Software Asset Management (SAM) installations. The script targets and updates specific records on the cmdb_sam_sw_install table to maintain data accuracy.
Note: This is a working workaround for a bug in Servicenow XANADU SAM application.

Overview
The primary purpose of this script is to ensure that software installations identified as non-licensable do not retain normalized product or publisher information. This prevents these specific records from being included incorrectly in SAM reconciliation and reporting. By clearing the normalization fields on these non-licensable items, the script improves data quality and the integrity of software asset reporting.

Key functions
Targeting non-licensable records: The script uses an encoded query to find all software installation records that have a populated norm_product field, but whose associated product record is not marked as licensable.

Clearing fields: It specifically clears the norm_product and norm_publisher fields on all matching records.

Performance optimization: The script is designed for bulk operations and optimizes performance by disabling business rules and workflows (gr.setWorkflow(false);) during the update process.

Usage
This script is intended to be executed in a ServiceNow instance, typically as a:

Fix Script: A one-time execution for a specific data cleanup task.
Scheduled Job: Can be scheduled to run periodically to maintain data consistency over time.

Important considerations
Backup: As with any data manipulation script, it is highly recommended to test the script thoroughly in a sub-production environment first. Running it on production data should be done with a prior backup or on a limited set of records initially.
Performance: The updateMultiple() method is used for efficiency. The setWorkflow(false) call prevents unnecessary business rule execution and significantly improves performance during large batch updates.
Dependency: The script relies on the Software Asset Management (SAM) Normalization feature being active, as it targets fields populated by that process.


Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Script Name: Remediate Non-licensable software install normalization
* Description: Finds all software installation records that have a normalized product,
* but where the normalized product is not marked as licensable.
* It then clears the 'norm_product' and 'norm_publisher' fields on these records.
* Purpose: This prevents non-licensable software installations from being included in
* Software Asset Management (SAM) reconciliation and ensures data accuracy
* for reporting.
*
* Execution: Typically run as a Fix Script or Scheduled Job.
*/

// Initialize a GlideRecord object for the Software Installation table.
var gr = new GlideRecord('cmdb_sam_sw_install');

// Add an encoded query to find the specific records to be updated.
// 'norm_productISNOTEMPTY' finds records where the normalized product field is not empty.
// '^' acts as the AND operator in an encoded query.
// 'norm_product.product_type!=licensable' filters for records where the product type
// of the normalized product is not 'licensable'.
gr.addEncodedQuery('norm_productISNOTEMPTY^norm_product.product_type!=licensable');

// Clear the normalized product field by setting its value to an empty string.
gr.setValue('norm_product', '');

// Clear the normalized publisher field.
gr.setValue('norm_publisher', '');

// This is a bulk update, so business rules are disabled for better performance.
// Disabling workflows (and business rules) prevents recursive updates and avoids triggering
// unnecessary logic for each record during this cleanup process.
gr.setWorkflow(false);

// Execute the update on all records that match the query conditions.
// The updateMultiple() method is more efficient for batch operations than iterating through each record with a while loop and calling update().
gr.updateMultiple();
Loading