- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:53 AM
I have location filed in form.When I am changing the location field it should check if that location has group in cmn_location table.if it has a group then I should get popup message like do not submit request.How to do this.
I tried this but it is not working
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:57 AM
Please below updated code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
var location = g_form.getDisplayValue('u_location');
var gr = new GlideRecord('cmn_location');
gr.addQuery('full_name', location);
gr.query();
if (gr.next()) {
var Group = gr.group; // Corrected variable name
if (Group !== '') { // Check if group is not empty
alert('Selected Location has group.'); // Corrected alert message
}
}
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:57 AM
Please below updated code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
var location = g_form.getDisplayValue('u_location');
var gr = new GlideRecord('cmn_location');
gr.addQuery('full_name', location);
gr.query();
if (gr.next()) {
var Group = gr.group; // Corrected variable name
if (Group !== '') { // Check if group is not empty
alert('Selected Location has group.'); // Corrected alert message
}
}
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:59 AM
Hi @Shahida07
You cannot use glide record in client script. You have to create a script include to check if the condition matches... And get the response back to client script and do the validation.
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 05:01 AM
can you help me with the script please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 05:03 AM