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 - last edited 3 weeks ago
The BR runs when the 'country' field is not empty. If supplied it must match one in the core_country table. and in my instance, there are choices defined for that field making it hard to use an invalid value. In-activate that BR until the source of the updates uses values for that field that match records in the core_company table. the OOB script has:
(function executeRule(current, previous /*null when async*/) {
var country = current.country;
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);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @BanuMahalakshmi ,
Check this thread for the same issue :- https://www.servicenow.com/community/upgrades-and-patching-forum/new-business-rule-on-user-table-in-...
If my answer helped you, please mark it- solution accepted.
Regards,
Nikhil Bajaj
Regards,
Nikhil Bajaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Make sure the source system sends valid country codes in the payload [ISO 3166-1 alpha-2 code]. Incoming data is validated against core_country table in ServiceNow for Country field and when it does not find the country code, insert operation fails and it is aborted.
Refer below knowledge article for this known error,
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB2310555
You can over-ride this behavior by disabling abort operation or making the BR inactive but it is not best practices and not recommended as this BR is put in place for a reason and is needed for maintaining data quality and valid reference if used in other related tables [for example, dashboard to show number of users based on location]
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Did you get a chance to review this ?
If my response helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
If you are not receiving this details from LDAP and this is causing issue then you are safe to Deactivate this business rule as this was newly added.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader