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 04:17 AM
Better have this variable lic count in variable set and this variable set can be included in multiple catalog items for each software license item . On variable set you can write a the same client script . By this way you will not be creating multiple clients scripts.
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 04:40 AM
yeah but Script include i need to write either multiple or single script include with multiple classes...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 05:30 AM
just single script include , no multiple classes.
Just put the same in one client script on variable set thats it.
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 06:39 AM
Hi,
this is the script include am using
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.addEncodedQuery('display_nameLIKEJetBrains IntelliJ IDEA');
lic.query();
var rowCount = lic.getRowCount();
gs.info("Row count: " + rowCount); // Add this line for debugging
return rowCount;
},
type: 'populatelicensecount1'
});
could you please tell me if any changes in the code needs to be done
thanks