Need count of licenses under software model form to be displayed in catalog form text field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 04:09 AM
Hi All,
In the table alm_license there is related list 'license entitlements' . For each software license there is catalog form so the requirement is user needs the number of count of 'license entitlements' to be displayed in one text field available in catalog form of each software catalog example "Variable name is lic count (type is multi line text filed).
I have achieved this for one catalog using script include and called the class into a on load catalog client script and it is working , however my issue here is I have total of more than 100 catalog for each Software , so do i need to create more than 100 script includes + Catalog client script ? or in one script include i need to write 100 classes and call in one catalog client script?
Any suggestions or help much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 06:59 AM
I belive licSysId contains the sys_id as per its name then script is straight fwd on variable set.
var populatelicensecount1 = Class.create();
populatelicensecount1.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getLicensecount: function(licSysId) {
gs.info("Received licSysId: " + licSysId); // Add this line for debugging
var lic = new GlideRecord('alm_license');
lic.addQuery('sys_id',licSysId);
lic.query();
var rowCount = lic.getRowCount();
gs.info("Row count: " + rowCount); // Add this line for debugging
return rowCount;
},
type: 'populatelicensecount1'
});
you just have to call the script include and its function with paramter that contains the sys_id for alm_license table (may be from other variable).
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 07:14 AM
Hi,
am using this catalog client script