Solved

"Unable to cast object of type..." error

  • 8 February 2023
  • 2 replies
  • 315 views

Userlevel 3
Badge

Hi, 

I need to add a smart panel when clicked on my Add Purchase button. The smart panel should include all the Purchase Orders inside a grid which are currently available in the database. So I created a graph extension of my parent Graph APProformaEntry and also a DAC extension of px.objects.po.POOrder standard DAC called POOrderExtension to define new fields if I need to add. But for now I didn’t add any new fields to the DAC Extension except the main key .

below screenshots show the code for the reference.

Graph Extension
DAC Extension

In the customization project editor, inside the dialogs, I added a pop-up panel and passed POrdersView which is previously defined view in the graph extension , as the Key. Now the issue is when I preview my changes before publish, it shows me the following error.

I have no idea about this error, even I have not defined any new fields or changed the data type of the main key OrderNbr,  in my DAC extension, this error is happening continuously. Have I done something wrong in the code.  can someone help to solve this?

Thanks.

icon

Best answer by jinin 8 February 2023, 11:01

View original

2 replies

Userlevel 7
Badge +11

Hi @oshadarodrigo64 

In the filter view, you added the extension DAC. Please change to POOrder. View will not allow extension DAC. but you can use the getextension and fetch the values wherever u need or insert/update.

Like below

Base.CurrentDocument.Current.GetExtension<POOrderExtention>().usrFieldname

Userlevel 5
Badge +3

Can you provide a code, which you’ve written not in the for of screenshots? It will be easier to nail down the problem.

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