How to display country code as country name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 02:06 AM - edited 11-22-2022 02:07 AM
I have a country field in 'ABC' case form, Based on account field in that form , the country field is displaying the value for ex: DE , but i have to achieve this as Germany , i.e., when account is selected , the country field should display as Germany instead of DE.
Basically the country field is dot-walked from form layout,,--> account.country
When checking on configure dictionary , the table name is core_company
When i click on show country field: These are the below info
Table: sn_customerservice_case
Field :account
Type: reference
Reference: customer_account
Reference Qual :new global.GenericUtils().getContactAccounts(current.contact.user_name );
Max Length : 32
How to achieve this with client script , i.e.., make the country field display country name instead of country code?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 03:05 AM
Hi @Buddy 1
You need to make 'Country Name' as Display instead of 'Country Code' in Country Table.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 03:07 AM
Hi,
Open the table which is referencing to account field and from Column List form section, change the "display" field value to true which you want to show. For ex. if you want the name to be displayed on the form and not the code, then set display field value of Name column to true and Code column value to false.
Please mark helpful if it resolves your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 03:12 AM
Hi @Buddy 1
You can create a custom string field 'Country' which will auto populate Country of Account.
You can achieve it using below onChange Client Script on Account field:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}
var account = g_form.getReference('account', doAlert);
}
function doAlert(account) {
g_form.setValue('u_country', account.country.name);
}
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 04:00 AM
Hi @AnubhavRitolia ,
Can you help me , after creating a custom country field, how to auto populate a country name based on account we choose. Because as of now it is matching the record from customer_account table