Skip to main content
Solved

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

  • February 8, 2023
  • 2 replies
  • 476 views

Forum|alt.badge.img

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.

Best answer by jinin

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

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

2 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 699 replies
  • Answer
  • February 8, 2023

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


Yuriy Zaletskyy
Jr Varsity I
Forum|alt.badge.img+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


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