- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 03:40 AM
I want to filter "Area / Subject / Expertise" field depending on the "Country for F.M.V calculation" field. So if I select for example "Albania" it should appear only relevant options in "Area / Subject / Expertise" field. How do I do that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 08:09 AM
Ok...the "country_for_fmv_calculation" is not Reference variable on catalog item....right...??
Can you try like below.....!!
javascript:'country.name=' + current.variables.country_for_fmv_calculation;
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 03:11 AM - edited 10-16-2023 03:13 AM
Hi @Jo_o Luis
As it's reference field, It will be difficult.
What I suggest is if possible, make the field type as "Lookup select box" & use "unique values only" option.
e.g.,
The screenshot below is just example...You can use your table & lookup value which you want to display.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 03:45 AM
Hey @Jo_o Luis,
Is it catalog item you using the portal? or the values from the form?
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 03:46 AM
Hello @Jo_o Luis
Use Catalog Client Script :- OnChange Script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if ( isLoading || newValue == '') {
return;
}
}
var con = g_form.getDisplayBox('country_field_name').value;
if (con == 'Albania'){
g_form.clearOptions('area_field_name');
g_form.addOption(<fieldName>, <choiceValue>, <choiceLabel>, <targetIndex>); // option 1
g_form.addOption(<fieldName>, <choiceValue>, <choiceLabel>, <targetIndex>); // option 2
g_form.addOption(<fieldName>, <choiceValue>, <choiceLabel>, <targetIndex>); // option 3
}
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 04:04 AM
I have a table with all options corresponding to a different countries... should I do a GlideRecord and then create an array to push all options that correspond to that country?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 04:22 AM
Hello @Jo_o Luis
You can't do GlideRecord in client script.
You need to use script include for the same.
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh