Quote Worksheet customization to add a hint of Part Advidsor

Hi all,

Estimation wants to add a small “Historical Data” group on the Quote worksheet with 3 Part-Advisor-like fields: Last Quote, Last Sale, Last Cost.

I know. Just use Part Advisor…

Anyway, I’m starting with Quote. So far I tried a UD field on QuoteQty, bound it to the new control, and I’m attempting to set the field via post-proc BPM on Quote.ChangePartNumMaster. But so far all of my attempts to fill the UD field by BPM Query have failed and produced errors. Should I be doing this via an event somewhere in the customization and using C# instead?

Show what you’ve done.
What were the errors?

The Terminator Arnold GIF by Animal's House

1 Like

Hey Kevin,

Okay I will show my work to the class prepare to be impressed.

Error message: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. (full text at the end)


At this point I’m just trying to achieve pulling any data from any db row into the column so I tried filtering on a specific QuoteNum.

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: QuoteDtl
Company=‘’ QuoteNum=‘0’ QuoteLine=‘0’ SysRowID=‘00000000-0000-0000-0000-000000000000’: ForeignKeyConstraint QuoteHedQuoteDtl requires the child key values (, 0) 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](IceTable1 sourceTSTable, TDataTable destinationTable) at lambda_method(Closure , IIceTable , DataTable ) at Ice.DatasetAdapter.Copy(IceTableset sourceTableset, DataSet destinationDataset) at Ice.Cloud.RpcSerializer.DeserializeDataSetFromTableset(Type tablesetType, Object initialValue, Boolean useSparseCopy, Stream stream) at Ice.Cloud.RestRpcValueSerializer.Deserialize(ProxyValueOutInfo valueOut, Boolean isMethodReturn, Stream stream) at Ice.Cloud.RestRpcValueSerializer.Deserialize(ProxyValuesOut valuesOut, Stream stream) at Ice.Cloud.ProxyBase1.CallWithMultistepBpmHandling(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Ice.Cloud.ProxyBase`1.Call(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Erp.Proxy.BO.QuoteImpl.ChangePartNumMaster(String& partNum, Boolean& lIsPhantom, Boolean& lIsSalesKit, String& uomCode, String rowType, Guid SysRowID, Boolean salesKitView, Boolean removeKitComponents, Boolean suppressUserPrompts, Boolean runChkPrePartInfo, String& vMessage, String& vPMessage, String& vBMessage, Boolean& vSubAvail, String& vMsgType, Boolean getPartXRefInfo, Boolean checkChangeKitParent, String& cDeleteComponentsMessage, Boolean& multipleMatch, Boolean& promptToExplodeBOM, String& explodeBOMerrMessage, QuoteDataSet ds)
at Erp.Adapters.QuoteAdapter.ChangePartNumMaster(String& partNum, Boolean& lIsPhantom, Boolean& lIsSalesKit, String& uomCode, String rowType, Guid sysRowID, Boolean salesKitView, Boolean removeKitComponents, Boolean suppressUserPrompts, Boolean runChkPrePartInfo, String& vMessage, String& vPMessage, String& vBMessage, Boolean& vSubAvail, String& vMsgType, Boolean getPartXRefInfo, Boolean checkChangeKitParent, String& cDeleteComponentsMessage, Boolean& multipleMatch, Boolean& promptToExplodeBOM, String& explodeBOMerrMessage)

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)

I guess my brain is broken. Sorry I don’t see it atm.

I am also just a broken machine.

Am I at least somewhat on the right track? If you were going to add last quoted price to the quote detail worksheet, would you do it via bpm?

yes

Your query is pulling more than one line. Need to be more specific.

1 Like

I’d use the setfield widget, and something like this on the changed row:

Db.QuoteQty.Where(x => x.QuoteNum == oldQuoteNum && x.QuoteLine == oldQuoteLine).FirstOrDefault().DocUnitPrice

2 Likes

I am more than a little embarrassed to admit I did not realize until this moment that you can just type C# into a set field expression like that. And you were right about the constraints too. Thank you for being so amazing.

Learned everything I know here.