I have a catalog item which user submits for software OS (WIN/MAC)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 05:24 AM
Hi,
I have a catalog item were user submits to get the software OS (WIN/MAC),
but the requirement is when user submits the RITM ,before submitting RITM it has to show the end user how many licenses we have in stock in servicenow .
how can we achieve this.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 07:26 AM
Hi @siddharth26
Do you have a way to track the available licenses for both Windows and Mac software ?
Maybe create a new table to store license information or utilizing an existing table.
In your catalog item's form, add a reference field that allows users to select the software OS they want (Windows or Mac).
Create a variable for displaying the available licenses. This variable will be used to calculate and display the number of licenses in stock based on the user's selection.
Create a client script that triggers when the software OS selection changes. This script will retrieve the available license count from the related record (e.g., the license table) based on the selected OS.
The script will then update the value of the "available licenses" variable on the catalog item form to display the license count to the end user.
sample script -
function onChangeSoftwareOS() {
var softwareOS = g_form.getValue('software_os'); // Get selected software OS
var availableLicenses = getAvailableLicenses(softwareOS); // Fetch available license count
if (availableLicenses !== null) {
g_form.setValue('u_available_licenses', availableLicenses); // Update the available licenses variable
}
}
function getAvailableLicenses(softwareOS) {
// Use AJAX or GlideAjax to query the license table and retrieve the available license count
// Return the available license count or null if there's an issue
}
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar