Single User receiving error

We have a custom built interface for data entry using one of the UD tables. We have not had any issue with anything until today when one user started receiving the error:

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Table: ShipToSrch

This isn’t showing up for any other user. I even went as far as to create a new user that mirrored the “trouble user” exactly and it didn’t receive the error. I’m at a loss here.

pretty sure @Ross.Fireball.Kuiper had this same thing?? Maybe?

Doesn’t sound familiar unfortunately…

I thought this was similar Part screen strange error - ERP 10 - Epicor User Help Forum (epiusers.help)

But it’s not!

2 Likes

Not sure it will help but here is the full error:

Application Error

Exception caught in: Epicor.ServiceModel

Error Detail

Message: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Table: ShipToSrch
SysRowID=‘ff3e9788-8ebe-478e-aea3-d63876d1d8fd’: ForeignKeyConstraint CustomerToShipToSrch requires the child key values (BWF, 107) to exist in the parent table.
Inner Exception Message: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
Program: Epicor.ServiceModel.dll
Method: CopyTSTableToDataTable

Client Stack Trace

at Ice.DatasetAdapter.CopyTSTableToDataTable[TIceRow,TDataTable](IceTable`1 sourceTSTable, TDataTable destinationTable)
at lambda_method(Closure , IIceTable , DataTable )
at Ice.DatasetAdapter.Copy(IceTableset sourceTableset, DataSet destinationDataset)
at Erp.Proxy.BO.CustomerImpl.GetRows(String whereClauseCustomer, String whereClauseCustomerAttch, String whereClauseCustomCrdPool, String whereClausePartner, String whereClauseCustBillTo, String whereClauseCustBank, String whereClauseCustChild, String whereClauseCustDfltDocType, String whereClauseCustIC, String whereClauseCustLabExpRate, String whereClauseCustMandate, String whereClauseCustomerDocs, String whereClauseCustRestriction, String whereClauseCustUPSEmail, String whereClauseCustomerDiscPriceLst, String whereClauseCustomerFSPriceList, String whereClauseGlbCustCred, String whereClauseMXCustomerFiscalText, String whereClauseNAMember, String whereClausePECustWhldHist, String whereClauseShipTo, String whereClauseShipToAttch, String whereClauseShipToRestriction, String whereClauseShipToLabExpRate, String whereClauseCustomerDocsSH, String whereClauseShipToDiscPriceLst, String whereClauseShipToMFBill, String whereClauseShipToPriceLst, String whereClauseShipToUPSEml, String whereClauseCustMFBill, String whereClauseMangCust, String whereClauseShipToSrch, String whereClauseCustomerPriceLst, String whereClauseEntityGLC, String whereClauseTaxExempt, Int32 pageSize, Int32 absolutePage, Boolean& morePages)
at Erp.Adapters.CustomerAdapter.OnGetRows(SearchOptions opts, Boolean& MorePages, String[] whereClauses)
at Ice.Lib.Framework.EpiBaseAdapter.GetRows(SearchOptions opts, Boolean& morePages)
at Ice.Lib.Searches.EpiSearchEngine.GetSearchResultsFromAdapterMethod(SearchOptions opts, SearchDataSetMode sdsMode)
at Ice.Lib.Searches.EpiSearchEngine.SearchUsingAdapterMethod(SearchOptions options)
at Ice.Lib.Searches.EpiSearchEngine.SearchIt(SearchOptions options, DataSet& results, Boolean& usedAdapter)
at Ice.Lib.Searches.EpiSearchEngine.SearchIt(SearchOptions options)
at Erp.Adapters.CustomerAdapter.InvokeSearch(SearchOptions opts)
at Script.custCB_ValueChanged(Object sender, EventArgs args)
at Infragistics.Win.UltraWinGrid.UltraCombo.OnValueChanged(EventArgs e)
at Ice.Lib.Framework.EpiUltraCombo.OnValueChanged(EventArgs e)

Inner Exception

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

at System.Data.DataSet.EnableConstraints()
at System.Data.DataSet.set_EnforceConstraints(Boolean value)
at System.Data.DataTable.EndLoadData()
at Ice.DatasetAdapter.CopyTSTableToDataTable[TIceRow,TDataTable](IceTable`1 sourceTSTable, TDataTable destinationTable)

This seems to key in on the keys that are missing from whatever table it is.

It’s just very odd that it’s for a solitary user. Also This is the point in the code where the error occurs:

		edvUD11.dataView[edvUD11.Row]["Date01"] = DateTime.Today;
		Erp.Adapters.CustomerAdapter CA = new Erp.Adapters.CustomerAdapter(this.oTrans);
		CA.BOConnect();
		SearchOptions optsC = new SearchOptions(SearchMode.AutoSearch);
		optsC.PreLoadSearchFilter = "CustNum = '" + customerComboC1.Value.ToString() + "' "; ;
		optsC.SelectMode = SelectMode.SingleSelect;		
		optsC.DataSetMode = DataSetMode.RowsDataSet;				
		CA.InvokeSearch(optsC);

Error occurs right here.

I had this happen the other day when doing a BAQ. It was working and running fine for all these other users, but for a certain user it was using a different SQL execution plan and for some reason, her query was filtering different records than the other user and one of the records had a field value that could not be converted into a string or whatever I was casting it to or something like that.

I had a similar problem at a SaaS client a few months ago, only one user would get the error when entering sales orders. Same ShipToSrch table error. This customer had the order entry screen customized to a fare-thee-well (which I hadn’t written), so I could only turn it back to their internal team. I don’t know if they ever solved it.

In the user’s case, all she ended up having to do was click OK on the error box, refresh the screen, and all was then well.

There was nothing in the customization that I could see that even cared who the user was, so it made no sense to me.

I have seen this error popup when the user does not have access to the Territories.

Had to add a workforce item Add the user to Authorized users and Check “View All Territories”

In case it helps somebody.