Skip to main content
Solved

GetExtension failed

  • April 24, 2026
  • 3 replies
  • 30 views

Forum|alt.badge.img+2

Hi, all
I create PXCacheExtension<PMProformaLine> and add new custom field.
Next i override method BillTask. 
In this method base functional create 
PMProformaTransactLine line = new PMProformaTransactLine();

And when i try this  AKTPMProformaLineExt lineExt = line.GetExtension<AKTPMProformaLineExt>();

I get this error. GetItemExtension failed. 

Best answer by Naveen Boga

Hi ​@bihalivan15  I think you are doing wrong CacheExtension, Please do like below.
Database table - PMProformaLine

CacheExtension - PMProformaTransactLine

PMProformaTransactLine line = new PMProformaTransactLine();

     // logic

line = ProformaTransactDetails.Insert(line);

and then use AKTPMProformaLineExt lineExt = line.GetExtension<AKTPMProformaLineExt>();

 

I think it should work, if not please share the your CacheExtension DAC and GraphExtension code as well, if possible.

 

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Answer
  • April 24, 2026

Hi ​@bihalivan15  I think you are doing wrong CacheExtension, Please do like below.
Database table - PMProformaLine

CacheExtension - PMProformaTransactLine

PMProformaTransactLine line = new PMProformaTransactLine();

     // logic

line = ProformaTransactDetails.Insert(line);

and then use AKTPMProformaLineExt lineExt = line.GetExtension<AKTPMProformaLineExt>();

 

I think it should work, if not please share the your CacheExtension DAC and GraphExtension code as well, if possible.

 


Forum|alt.badge.img

Hi ​@bihalivan15 ,

The GetExtension failed error happens because PMProformaTransactLine and PMProformaLine are treated as separate DACs. Extensions are registered per DAC type, so an extension targeting PMProformaLine will not be found on a PMProformaTransactLine object.

To fix this, create an extension specifically for PMProformaTransactLine:
 

public class AKTPMProformaTransactLineExt : PXCacheExtension<PMProformaTransactLine>

{

[PXDBString(10)]

[PXUIField(DisplayName = "Custom Field")]

public string UsrCustomField { get; set; }

public abstract class usrCustomField : PX.Data.BQL.BqlString.Field<usrCustomField> { }

}

Then, access it in your code using the new class name:

var lineExt = line.GetExtension<AKTPMProformaTransactLineExt>();

if (lineExt != null)

{

string value = lineExt.UsrCustomField;

}


Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • April 24, 2026

@bihalivan15  Glad I could help! Let me know if you need anything else.