Solved

Upgraded from 2020 R2 to 2022 R2 and got the following error in vendors details;Unable to cast object of type 'APDocumentResult' to type 'PX.Data.PXResult`1[PX.Objects.AP.APDocumentEnq+APDocumentResult]'

  • 14 January 2023
  • 4 replies
  • 146 views

Userlevel 4
Badge

The following is the code causing the errors;

 

Unable to cast object of type 'APDocumentResult' to type 'PX.Data.PXResult`1[PX.Objects.AP.APDocumentEnq+APDocumentResult]

 

 

 

 

What could be the issue?

Kindly assist

Thank you

icon

Best answer by Michael Ndungi 5 May 2023, 16:27

View original

4 replies

I would suggest trying

foreach(APDocumentEnq.APDocumentResult item in list)

I believe you are already casting the select result to a list of objects which is returning a list of APDocumentResult objects. The error is likely coming from the foreach statement where you are trying to cast it to a PXResult type.

Userlevel 4
Badge

 Thanks for the response.

 

I applied the change that you suggested. 

Got the following error in publishing;

\App_RuntimeCode\APDocumentEnq.cs(49): error CS1061: 'APDocumentEnq.APDocumentResult' does not contain a definition for 'GetItem' and no accessible extension method 'GetItem' accepting a first argument of type 'APDocumentEnq.APDocumentResult' could be found (are you missing a using directive or an assembly reference?)

 

CODE:

 

 

Kindly assist

Thank you

Userlevel 7
Badge

Hi @mray56  were you able to find a solution? Thank you!

Userlevel 4
Badge

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved