Krunal
Krunal

Reputation: 1188

PXException is throwing error instead of error message in the grid

I am using PXException, however instead of showing an error message in the grid it is throwing an unhandled exception.

throw new PXException("Error message");

Error Message--

Below error I am getting--

Error: Error #145: One or more items have not been processed. Send Raised At: 4/24/2015 2:38:55 PM Screen: ES.60.60.60 Command: Process
Details: 4/24/2015 2:38:55 PM Error: Error #145: One or more items have not been processed.

at PX.Data.PXProcessingBase1.<>c__DisplayClass131.b__11(List1 list) at PX.Data.PXProcessing1.Process(PXAdapter adapter) at PX.Data.PXAction1.a(PXAdapter A_0) at PX.Data.PXAction1.d__c.MoveNext() at PX.Data.PXAction`1.d__c.MoveNext() at PX.Web.UI.PXBaseDataSource.tryExecutePendingCommand(String viewName, String[] sortcolumns, Boolean[] descendings, Object[] searches, Object[] parameters, PXFilterRow[] filters, DataSourceSelectArguments arguments, Boolean& closeWindowRequired, Int32& adapterStartRow, Int32& adapterTotalRows) at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)

Upvotes: 0

Views: 2942

Answers (2)

Dipak
Dipak

Reputation: 3

I had the same issue, the problem was my Grid was pointing to my PXSelect<...> data view instead of PXProcessing<...> data view.
I also set the following properties on the grid, (same as an existing working Processing window). AllowPaging = true
BatchUpdate = true
ID = grid
SkinID = PrimaryInquire
AllowSearch = True
NoteIndicator = True

Works like other screens now.

Upvotes: 0

HDanh
HDanh

Reputation: 225

You can use this

throw new PXSetPropertyException("Message", PXErrorLevel.RowError);

Edited syntax:

sender.RaiseExceptionHandling("fieldName", row, null, new PXSetPropertyException("Message", PXErrorLevel.RowError))

After digging in Acumatica source code I found this:

PXProcessing<APRegister>.SetError(i, e);

i - index of your current processing records; e - the exception

Upvotes: 2

Related Questions