A new business rule was inserted on the sys_user table with Yokohama Patch 5. KB2310555
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
A new business rule was inserted on the sys_user table with Yokohama Patch 5. The BR is called "Prevent invalid country code" and has a sys_id of 7cf7a7941bdc0c1ce19fb91bcd4bcbf2. This is causing an issue with updating users all of a sudden. If a user has an invalid Country value, all of a sudden no updates can occur on the user until this is corrected. I have update prevent invalid country code script but it didnt work.. still import sets failed to run. below is the script i tried:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The OOTB Country field on User table is a choice field with 2 digit country codes as choice values. Was it updated as reference type in your instance?
if it is a reference field, then your script should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
No, i didnt update as reference field. its choice field type only. pls suggest - if i update this field type as reference, which table should i call to fetch country code values?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
'core_country'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
I don't see such a BR defined for sys_user in my PDI: yokohama-12-18-2024__patch3-04-17-2025_04-30-2025_1345. I would just delete it. the line:
' coreCountryGR.addQuery("iso3166_2", .country).addOrCondition("sys_id", country);'
is suspect as a country field value won't contain a sys_id, it is defined as a String with length 3 on sys_user table. If you want it to work, change the commented out line:
"coreCountryGR.addQuery("iso3166_2", country).addOrCondition("iso3166_3", country);"
to
var queryStr = ''iso3166_2='+current.country+'^ORiso3166_3='+current.country;
coreCountryGR.addEncodedQuery(queryStr);
try the following in Scripts - background:
var usr = new GlideRecord('sys_user');
usr.addQuery('country', '!=', '');
usr.query();
while (usr.next()) {
gs.info('User: ' + usr.user_name + ', country: ' + usr.country);
var cc = new GlideRecord('core_country');
var queryStr = 'iso3166_2='+usr.country+'^ORiso3166_3='+usr.country;
cc.addEncodedQuery(queryStr);
cc.query();
if(cc.next()) {
gs.info('The country is ' + cc.name);
}
}
I have read the KB2310555 and see that is related to LDAP Import. I would not expect that BR to run for updates via the UI, I'll review the BR after my instance upgrades.