Display Value from table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2020 11:41 PM
I have a table whose display_value=true set for location field.
I'm creating 1 catalog where for 1 reference variable I have to select country field from same table. Is it possible to populate country field value rather than location field? and how?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 12:24 AM
Hi Hafsa,
that's because your custom table display value is set to true for location field and not the country
if you want to show country in the reference variable then make display=true for country field or add the attributes to that variable
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 12:21 AM
Please write down catalog client script:
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('country ', doAlert); // doAlert is our callback function
}
function doAlert(country ) { //reference is passed into callback as first arguments
g_form.setValue('cmn_location',location);
}
g_form.setValue('cmn_location',location);//Please change the variable name that you have exactly on your catalog form and table name.
Kindly mark the answer Correct and Helpful if this answers your question.
Ali.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 01:38 AM
Not helpful.
I have a custom table say "u_countryLocation_lookup" table where "location" field's display value=true. This location is used many other places hence, we can't change display_value=true.
Now in catalog item which I'm creating I have to query same table and get the country name(china_es, china_sw etc .) filled in variable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 06:08 AM
Hi
Just one question... Maybe you need to have a different approach..
What if your custom reference table would hold duplicate records in the "country" field, like
Location | Country | sys_id (of record in your custom table) |
A | DE | 1 |
B | DE | 2 |
C | US | 3 |
D | US | 4 |
If you take this table as "Reference" to your Variable, you may end up having numerous duplicate records for country, which in fact you maybe do not want to...
Maybe you just need to created (or take) a different Reference table for selecting the Country?!?
Let me know if that answers your question, please.
BTW: I tried and did not find a way to make the UI act as you wrote above.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 06:25 AM
Hi Dirk
yes, that is the case. So, our custom table have many fields but below 4 are useful. Here for location field display=true
Now , in catalog we have created 2 variables. u_country and u_group and both are reference fields from same table "u_countryLocation_lookup".
If I select u_country it should show me "DE".
for u_group = "xyz"
But for both fields it is showing me "A" . That is my issue. I have to reference both fields from this table only. THis is not generic country/location issue but specific to this table.
Location | Country | sys_id (of record in your custom table) | group |
A | DE | 1 | xyz |
B | DE | 2 | ABC |
C | US | 3 | DEF |
D | US | 4 | GHI |