Skip to main content
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]'


Michael Ndungi
Varsity I
Forum|alt.badge.img

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

Best answer by Michael Ndungi

 

View original
Did this topic help you find an answer to your question?

  • Freshman I
  • January 15, 2023

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.


Michael Ndungi
Varsity I
Forum|alt.badge.img

 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


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • March 15, 2023

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


Michael Ndungi
Varsity I
Forum|alt.badge.img

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings