Skip to main content
Solved

Copy UDF from PO Line to AP Invoice when entering AP Bill from PO


Could someone please help in providing a solution of moving the UDF from PO into AP Invoice?

I am new to developing in acumatica. I have created the user defined fields in POLine and APTran.

While reviewing the source of APInvoiceEntry, I looked at overriding the method CopyCustomizationFieldsToAPTran.

Code I added is below.

public void CopyCustomizationFieldsToAPTran(APTran apTranToFill, IAPTranSource poSourceLine, Boolean areCurrenciesSame, CopyCustomizationFieldsToAPTranDelegate baseMethod)
    {
  
      baseMethod(apTranToFill,poSourceLine,areCurrenciesSame);

      var portID = poSourceLine.GetExtension<POLineExt>()?.UsrPortID;
      var tranline = apTranToFill?.GetExtension<APTranExt>()?.UsrPortID;         
      
      if (tranline != null && portID != null ) tranline.UsrPortID = portID;

    }

I am getting validation errors when I try to publish.

error CS1929: 'IAPTranSource' does not contain a definition for 'GetExtension' and the best extension method overload 'PXCacheEx.GetExtension<POLineExt>(IBqlTable)' requires a receiver of type 'IBqlTable'
error CS1061: 'string' does not contain a definition for 'UsrPortID' and no accessible extension method 'UsrPortID' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
error CS1929: 'IAPTranSource' does not contain a definition for 'GetExtension' and the best extension method overload 'PXCacheEx.GetExtension<POLineExt>(IBqlTable)' requires a receiver of type 'IBqlTable'

Am I using the correct method to accomplish the task?

@darylbowman  @Vignesh Ponnusamy 

 

We installed the customization into  Acumatica 2023 R2 Build 23.212.0024 and It now works, thank you to both of you!


Happy to help. Could you mark Vignesh’s post as the best answer?


Reply