- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 09:54 AM
What is causing sys_user.country field to only accept United States and not USA in sys_user table country field? It appears to have started with Xanadu Patch 9.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 10:04 AM - edited 07-21-2025 10:06 AM
Hi @Renee-17 ,
we have faced the similar issue
there are two BRs added in the patch (Prevent invalid country code & Prevent invalid language code)
check if those are the once causing the issue
as per that BR (US should be the choice value not USA)
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 10:04 AM - edited 07-21-2025 10:06 AM
Hi @Renee-17 ,
we have faced the similar issue
there are two BRs added in the patch (Prevent invalid country code & Prevent invalid language code)
check if those are the once causing the issue
as per that BR (US should be the choice value not USA)
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 01:01 PM
Thanks Chaitanya - I thought it was related to something like this. Thanks for pointing out the business rule. I inactivated it for now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 01:27 PM
Hi KamiIT - (not sure where your original reply went but you asked some specific questions that I was researching... so I'll still answer them)
Our code sets the country value for a user in the sys_user table to USA when they request an account. This seems to work fine as I don't see the error msg in the logs related to the business rule that gives msg "Attempt to insert/update an invalid value for sys_user.country: USA" .
The error does occur when other fields are being updated in the record at a later point. It won't allow the update to happen unless I also update the country field and select the United States entry for country where USA was formerly inserted when user requested the account.
It looks like the addQuery clause "iso3166_2", country is the culprit when the sys_user record is being updated:
// This code was run as a script in the background, so I hard coded a value for country
// and commented out the current.setAbortAction statement.
var country = "USA";
var coreCountryGR = new GlideRecord("core_country");
coreCountryGR.addQuery("iso3166_2", country);
coreCountryGR.query();
if(coreCountryGR.getRowCount() == 0) {
gs.warn("Attempt to insert/update an invalid value for sys_user.country: " + country);
// current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 01:40 PM
Looking further into the Business Rule "Prevent invalid country code". The BR has the condition of !current.country.nil().
It is set to be triggered before insert or update. Because country is nil during insert, the advanced script for the BR is not executed but it is executed during update which is when the error occurs in my situation.