Skip to main content
Answer

How do I access the extension of the ARTran table to access a custom field in that table?

  • March 29, 2023
  • 2 replies
  • 151 views

Forum|alt.badge.img

Hi,

I have added a custom field to the ARTran table but I am getting an error when trying to access the extension of this table to update this custom field via code.

I imagine I need to replace ‘ARTran’ with something else, but not sure what it would be.

Here is the code I am currently using to access this extension:

var row = (ARTran)e.Row;
ARTran rowExt = row.GetExtension<ARTran>();

And here is the error I get:

\App_Code\Caches\ARInvoiceEntry.cs(55): error CS0311: The type 'PX.Objects.AR.ARTran' cannot be used as type parameter 'TExtension' in the generic type or method 'PXCacheEx.GetExtension<TExtension>(IBqlTable)'. There is no implicit reference conversion from 'PX.Objects.AR.ARTran' to 'PX.Data.PXCacheExtension'.

What do you suggest I replace ARTran with to access the custom field via the extension?

 

Kind regards,

Andrew

Best answer by aaghaei

var row = (ARTran)e.Row;
ARTranExt rowExt = row.GetExtension<ARTranExt>();

2 replies

aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • Answer
  • March 29, 2023
var row = (ARTran)e.Row;
ARTranExt rowExt = row.GetExtension<ARTranExt>();

Forum|alt.badge.img
  • Author
  • Varsity I
  • March 29, 2023

Hi Reza,

Thanks so much for that, completely forgot about adding that ‘Ext’ bit on the end, I’ll make sure to remember that for next time.

Kind regards,

Andrew