Subscription management Access
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2025 03:33 PM
Hi Team,
How can i access the Subscription management via Script?
I want to be able to create a Business Rule with a warning msg to user, case there is no Subscription available
Thank's in advanced
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 08:13 AM
Hi @Rafael Batistot ,
Try below BR
(function executeRule(current, gS, gUser, gSUtil) {
// Define the subscription you're checking for
var productName = "ITSM Enterprise"; // example
var licenseType = "requester"; // adjust as needed
// Query the subscription record
var subGR = new GlideRecord('sn_subscriptions.subscription');
subGR.addQuery('product_name', productName);
subGR.addQuery('license_type', licenseType);
subGR.query();
if (subGR.next()) {
var total = subGR.getValue('quantity');
var used = subGR.getValue('used');
if (parseInt(used) >= parseInt(total)) {
gs.addInfoMessage("Warning: No available subscriptions for " + productName + ". Please contact admin.");
}
} else {
gs.addInfoMessage("Warning: Subscription info not found for " + productName + ".");
}
})(current, gs, gs.getUser(), gs.getSession());
If my response helped, please hit the 👍Thumb Icon and accept the solution so that it benefits future readers.
Regards,
Pratik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 08:56 AM