USA is no longer accepted in the sys_user.country field

Renee-17
Tera Guru

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. 

1 ACCEPTED SOLUTION

Chaitanya ILCR
Mega Patron

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)

ChaitanyaILCR_0-1753117360422.png

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

6 REPLIES 6

Chaitanya ILCR
Mega Patron

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)

ChaitanyaILCR_0-1753117360422.png

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Thanks Chaitanya - I thought it was related to something like this.  Thanks for pointing out the business rule.  I inactivated it for now.  

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);
	}

 

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.