back to top

Infor CRM error logging in “query did not return a unique result: 2.”

We recently ran into an issue where a client was suddenly unable to login to the web client at all. As soon as they entered their credentials into the Login page, an error would occur. Looking into the event logs the stack trace was:

“message”: “query did not return a unique result: 2.”,
“source”: “NHibernate.Impl.AbstractQueryImpl, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4”,
“type”: “NHibernate.NonUniqueResultException”,
“stackTrace”: ” at NHibernate.Impl.AbstractQueryImpl.UniqueElement(IList list)\r\n at NHibernate.Impl.CriteriaImpl.UniqueResult[T]()\r\n at NHibernate.Criterion.QueryOver`1.SingleOrDefault()\r\n at NHibernate.Criterion.QueryOver`1.NHibernate.IQueryOver.SingleOrDefault()\r\n at Sage.SalesLogix.Web.Controls.PageLink.CheckExistHostedHelpLanguage(String helpLang, String appPortalName)\r\n at Sage.SalesLogix.Web.Controls.PageLink.FormatHelpUrl(String helplang, String helpTopic)\r\n at Sage.SalesLogix.Web.Controls.PageLink.GetHelpNavUrlFromFileName(String navUrl)\r\n at Sage.SalesLogix.Web.Controls.PageLink.GetWebHelpLink()\r\n at SmartParts_ClientLinkHandler_ClientLinkHandler.Page_Load(Object sender, EventArgs e)\r\n at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)\r\n at System.Web.UI.Control.OnLoad(EventArgs e)\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)”,
“targetSite”: “System.Object UniqueElement(System.Collections.IList)”,
“fullException”: “System.Web.HttpUnhandledException (0x80004005): Exception of type ‘System.Web.HttpUnhandledException’ was thrown. —> NHibernate.NonUniqueResultException: query did not return a unique result: 2\r\n at NHibernate.Impl.AbstractQueryImpl.UniqueElement(IList list)\r\n at NHibernate.Impl.CriteriaImpl.UniqueResult[T]()\r\n at NHibernate.Criterion.QueryOver`1.SingleOrDefault()\r\n at NHibernate.Criterion.QueryOver`1.NHibernate.IQueryOver.SingleOrDefault()\r\n at Sage.SalesLogix.Web.Controls.PageLink.CheckExistHostedHelpLanguage(String helpLang, String appPortalName)\r\n at Sage.SalesLogix.Web.Controls.PageLink.FormatHelpUrl(String helplang, String helpTopic)\r\n at Sage.SalesLogix.Web.Controls.PageLink.GetHelpNavUrlFromFileName(String navUrl)\r\n at Sage.SalesLogix.Web.Controls.PageLink.GetWebHelpLink()\r\n at SmartParts_ClientLinkHandler_ClientLinkHandler.Page_Load(Object sender, EventArgs e)\r\n at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)\r\n at System.Web.UI.Control.OnLoad(EventArgs e)\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)\r\n at System.Web.UI.Page.HandleError(Exception e)\r\n at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)\r\n at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)\r\n at System.Web.UI.Page.ProcessRequest()\r\n at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)\r\n at System.Web.UI.Page.ProcessRequest(HttpContext context)\r\n at ASP.default_aspx.ProcessRequest(HttpContext context)\r\n at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)\r\n at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)”,

After turning on Nhibernate logging using Log4Net I was able to find the problem. So you don’t have to go through that lets see what is going on…

The specific issue is that there is a duplicate row being added into the CUSTOMSETTINGS table. The row was something with CATEGORY=”LocaleConfig” and DESCRIPTION containing “{some value}|webclientLocaleConfig”.

I reviewed the code base of the SLX web client. The only place that writes this value to the CUSTOMSETTINGS table for LocaleConfig row is by going to the web client’s Administration/Office Profiles and then opening the detail record. On the detail screen there is a Help tab. On that tab is a Supported Languages drop down for the web client. When you press the Save button on that tab it calls a standard method called: UpdateLocaleConfig.

This UpdateLocaleConfig code is as follows:

string key = officeprofile.Id.ToString() + "|" + portalName + "LocaleConfig";
MySlx.Data.RemoveFromCache(key);
var factory = EntityFactory.GetRepository<ICustomSetting>();
ICustomSetting setting = factory.FindFirstByProperty("DataKey", key);
if (setting != null) {
setting.DataValue = localeCSV;
}
else {
setting = EntityFactory.Create<ICustomSetting>();
setting.DataKey = key;
setting.Description = key;
setting.Category = "LocaleConfig";
setting.DataValue = localeCSV;
setting.DataType = "Other";
setting.DataValidation = "Any Characters";
}

setting.Save();

The issue here is that it attempts to find the CUSTOMSETTINGS row matching on DATAKAEY using the variable “key” which using the value officeprofile.Id + “|” + portal name + “LocaleConfig.

The issue is that the original row in the CUSTOMSETTINGS table had a datakey value of “7Hrp|Webclientlocaleconfig”. However this code takes the officeprofile.Id and appends that to the rest of the formatted string. The officeprofile.Id is actually a database char(12) field, meaning that the officeprofile.Id returned is not just “7Hrp” but is in fact “7Hrp “. The resulting value it looks for is “7HRP |webclientLocaleConfig”. Since it does not find a row matching “7HRP |webclientLocaleConfig”, because the existing row is “7Hrp|Webclientlocaleconfig”, it adds a new row. This is where the problem comes from.

Other code in the system looks for the CUSTOMSETTINGS value by matching on CATEGORY and DESCRIPTION. When searched this way it finds two matching rows and the system errors out and results in what Harbert saw. By removing the duplicate erroneously added row the web client could log back in.

This does still appear to be an issue in the latest 9.3 version. So if you are receiving this error, hopefully this post will help you to fix things. Infor should change that UpdateLocaleConfig method to get the key value using a trimmed version of the Id, like so:

string key = officeprofile.Id.ToString().Trim() + "|" + portalName + "LocaleConfig";
Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Kris Halsrud
Kris Halsrud
Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos