0
votes

I have had added CrossItem attribute to the InventoryID field in Appointments page. But, this caused inventory id invalid cast issue. enter image description here

This is how I have added the attribute to the property.

enter image description here

And here is the stack trace of it. 1/4/2018 10:56:49 AM Error: Error: An error occurred during processing of the field Inventory ID : Specified cast is not valid..

System.InvalidCastException: Specified cast is not valid. 
   at System.Data.SqlClient.SqlBuffer.get_Int32() 
   at PX.Data.PXDataRecord.GetInt32(Int32 i) 
   at PX.Data.PXDBIntAttribute.RowSelecting(PXCache sender, PXRowSelectingEventArgs e) 
   at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly) 
   at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly) 
   at PX.Data.PXCache`1.Select(PXDataRecord record, Int32& position, Boolean isReadOnly, Boolean& wasUpdated) 
   at PX.Data.PXView.GetResult(Object[] parameters, PXFilterRow[] filters, Boolean reverseOrder, Int32 topCount, PXSearchColumn[] sorts, Boolean& overrideSort, Boolean& extFilter) 
   at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) 
   at PX.Data.PXView.SelectMultiBound(Object[] currents, Object[] parameters) 
   at PX.Data.PXSelectBase`1.selectBound(Object[] currents, Object[] arguments) 
   at PX.Objects.FS.AppointmentEntry.FSServiceOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e) in F:\Bld2\AC-FULL2017R201-JOB1\sources\WebSites\Pure\PX.Objects.FS\AppointmentEntry.cs:line 6983 
   at PX.Data.PXRowSelected.Invoke(PXCache sender, PXRowSelectedEventArgs e) 
   at PX.Data.PXCache.OnRowSelected(Object item) 
   at PX.Data.PXCache`1.set_Current(Object value) 
   at PX.Data.PXGraph.ExecuteSelect(String viewName, Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) 
   at PX.Data.PXGraph.ExecuteSelect(String viewName, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) 
   at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments) 
   at PX.Web.UI.PXDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments) 
   at PX.Web.UI.PXDataSourceView.Select(DataSourceSelectArguments arguments, PXDSSelectArguments swarguments, DataSourceViewSelectCallback callback) 
   at PX.Web.UI.PXFormDataProvider.DataBind() 
   at PX.Web.UI.PXBoundPanel.PerformSelect() 
   at System.Web.UI.Control.DataBindChildren() 
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) 
   at System.Web.UI.Control.DataBindChildren() 
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) 
   at System.Web.UI.Control.DataBindChildren() 
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) 
   at System.Web.UI.Control.DataBindChildren() 
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) 
   at PX.Web.UI.PXBoundPanel.OnAfterSelect(PXFormDataProvider provider) 
   at PX.Web.UI.PXFormDataProvider.a(IEnumerable A_0) 
   at PX.Web.UI.PXFormDataProvider.DataBind() 
   at PX.Web.UI.PXCallbackManager.a(Dictionary`2 A_0, List`1 A_1) 
   at PX.Web.UI.PXCallbackManager.a(PXCallbackResultMethod A_0, XmlWriter A_1) 
   at PX.Web.UI.PXCallbackManager.a(PXCallbackResultMethod A_0) 

I have had the same issue in Service Orders page too. How do I resolve this issue?

Thanks.

1
What if you replace the attributes vs append as I assume the InventoryID field already has the InventoryAttribute attached to the field? - Brendan
You are right. That's what I did. RuslanDev's screenshot helped me understand the solution even better. Thank you. - Bikash Lama

1 Answers

2
votes

This error happens because of duplicated attributes on the InventoryID field: the Append to Original option will always append the list of original attributes with your custom ones.

The error should be resolved after you switch to the Replace Original option, as shown in the screenshot below: enter image description here