Can we show the table data on the catalog form once we enter the value in the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 06:58 PM
Hi All,
Having a requirement that,
we are having a catalog form, through that we are trying to insert a record into software model table.
we have three fields on the form
1- Software name (free text)
2- Publisher - (reference- company )
3- Version - free text
Once the form loads and we enter any value in the software name, then can we show the relavent records from the model table on the form like as info or alert.
Example - Office (software name ) that i entered in the software name field
popup comes and give the relevant records like office 2016, office 2017, 0ffice 2018
which it shows the available data from the table.
Can we do that, any suggestions.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 07:17 PM
Hi @Community Alums ,
This can be achieved via onchange script where once when the name is entered u can pass th value to script include via GlideAjax n fetch if there are any software models with that name n return those values to client script where u can display it as an alert.
One more way I could suggest is. This will be without scripting one. Create 3 fields on ur form for software model name.
One will be reference where it will be referencing from the software model table where people can type the name n if any model with that name is der it will show all of them in the drop-down.
Lets say if no choice appears in the 1st field we can have a second field which will be a checkbox named as name not found ,if that is clicked 3rd field with single line text will appear where user can enter whtever thay want n then once form submitted u can create a record in the backend table.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 08:57 PM
Use a onChange Client Script on the "Software Name" field (Question 1) to trigger an AJAX call when the user enters a value.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) {
return;
}
// Prepare AJAX request parameters
var params = { 'software_name': newValue };
// Make an AJAX call to server-side script
GlideAjax.getXML('getSoftwareModels', params, function(response) {
var message = response.responseText;
// Display message or populate based on response
if (message) {
g_form.addInfoMessage(message);
// Display message }
else {
// No matching records found (Optional: Handle this scenario)
}
});
}