Skip to main content
Question

Alternate method for FindOrCreatePOLineDelegate to use in 25R2

  • March 19, 2026
  • 1 reply
  • 56 views

Forum|alt.badge.img+1

Hello! The below code is running great in 25R1. It tells the system to look at the UsrQUOTECOST field on SOLine when create a PO through Create Purchase Order. If UsrQUOTECOST is empty, then system should behave the same, if user inputs value in UsrQUOTECOST, then when PO is created, the unit cost field should pull from this udf.

The issue I am running into is that when I try to publish this code in a 25R2 tenant, I get the following error: The PX.Objects.PO.POLine FindOrCreatePOLine(PX.Objects.PO.POOrderEntry, PX.Objects.CS.DocumentList`1[PX.Objects.PO.POLine], System.String, PX.Objects.PO.POFixedDemand, SOLineSplit3, FindOrCreatePOLineDelegate) method in the PX.Objects.PO.POCreate_Extension graph extension is marked as [PXOverride], but no original method with this name has been found in PXGraph.

And per the 25R2 developer release notes, looks like the FindOrCreatePOLine method was removed. Any ideas around what the alternative method would be to make this code work? Open to any suggestions, thank you all!

 

#region Event Handlers

    public delegate POLine FindOrCreatePOLineDelegate(POOrderEntry docgraph, DocumentList<POLine> ordered, String orderType, POFixedDemand demand, SOLineSplit3 soline);
    [PXOverride]
    public POLine FindOrCreatePOLine(POOrderEntry docgraph, DocumentList<POLine> ordered, String orderType, POFixedDemand demand, SOLineSplit3 soline, FindOrCreatePOLineDelegate baseMethod)
  {
    // Call the base method to get or create the POLine
    POLine poLine = baseMethod(docgraph, ordered, orderType, demand, soline);
    if (poLine != null && soline != null)
    {
        // Fetch the associated SOLine using its line reference
        SOLine soLine = PXSelect<SOLine,
                            Where<SOLine.orderType, Equal<Required<SOLine.orderType>>,
                                And<SOLine.orderNbr, Equal<Required<SOLine.orderNbr>>,
                                And<SOLine.lineNbr, Equal<Required<SOLine.lineNbr>>>>>>
                            .Select(docgraph, soline.OrderType, soline.OrderNbr, soline.LineNbr);
     if (soLine !=null)
     {
       
      // Retrieve the extensions
       
       var soLineExt = PXCache<SOLine>.GetExtension<SOLineExt>(soLine);
       if (soLineExt != null &&    soLineExt.UsrQUOTECOST.HasValue &&    soLineExt.UsrQUOTECOST.Value > 0m)
       
       {     poLine.CuryUnitCost = soLineExt.UsrQUOTECOST;
            }
       }
       }
           
    return poLine;
}

    #endregion     

1 reply

arpine08
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • March 19, 2026

Hello ​@jzhu,

The new PX.Objects.SO.GraphExtensions.POOrderEntryExt.CreatePOOrdersFromSODemandsExtension graph extension handles obtaining the values from the SOOrder, SOLine, and SOLineSplit DACs (in 2025 R2 the logic managing the relationship between Sales Orders and Purchase Orders has been moved to separate extensions).

You can override, for example, the LinkPOLineToSource method to implement your logic.

 public class CreatePOOrdersFromDemandsExtensionExt : PXGraphExtension<CreatePOOrdersFromSODemandsExtension, POOrderEntry>
{
public static bool IsActive() { return true; }

#region Overrides
#region LinkPOLineToSource
public delegate POLine LinkPOLineToSourceDelegate(POLine poLine, POFixedDemand demand, PODemandSourceInfo demandSource);
[PXOverride]
public POLine LinkPOLineToSource(POLine poLine, POFixedDemand demand, PODemandSourceInfo demandSource, LinkPOLineToSourceDelegate baseMethod)
{
var result = baseMethod(poLine, demand, demandSource);

SOLine soLine = SOxPODemandSourceInfo.Of(demandSource).Line;
SOLineSplit3 soLineSplit = SOxPODemandSourceInfo.Of(demandSource).Split;

// Your Logic here

return result;
}
#endregion
#endregion
}