Skip to main content
Answer

Copy User-defined field values

  • June 9, 2025
  • 3 replies
  • 103 views

Prasadug
Jr Varsity II
Forum|alt.badge.img

Hi,

I have added user-defined fields to the Sales Order (SO) screen. In our client’s business process, user create BL order type Sales Orders, and if the user enters values into these user-defined fields, they should be copied to the child orders linked to the BL order without duplicating the data insert work. 

Kindly help me to fullful this requirement.

Thanks/Prasad

Best answer by Vignesh Ponnusamy

Hi ​@Prasadug,

You can try like below, by copying the UDFs in SOLine RowUpdated event. This method isn’t the best, but I couldn’t find any other method where we could copy the UDFs.    

    public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
{
#region Event Handlers
public void SOLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated baseEvent)
{
baseEvent?.Invoke(cache, e);
SOLine row = (SOLine)e.Row;
if (row.BlanketNbr != null)
{
SOOrderEntry blOrder = PXGraph.CreateInstance<SOOrderEntry>();
blOrder.Document.Current = PXSelect<SOOrder, Where<SOOrder.orderType, Equal<Required<SOOrder.orderType>>,
And<SOOrder.orderNbr, Equal<Required<SOOrder.orderNbr>>>>>.Select(Base, row.BlanketType, row.BlanketNbr);
var AttributeAMBATLEN = blOrder.Document.Cache.GetValueExt(blOrder.Document.Current, "AttributeAMBATLEN");
if (AttributeAMBATLEN != null)
{
//blOrder.Document.Cache.SetValueExt(blOrder.Document.Current, "AttributeAMBATLEN", AttributeAMBATLEN.ToString());
Base.Document.Cache.SetValueExt(Base.Document.Current, "AttributeAMBATLEN", AttributeAMBATLEN.ToString());
}
}
}
#endregion
}

Please feel free to reach me if you have any questions! Good Luck,

3 replies

Forum|alt.badge.img+7
  • Captain II
  • June 9, 2025

How are the child orders being created?


Prasadug
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • June 10, 2025

Hi Django,

Always from the blancket Order screen by Create Child Order Button

 


Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

Hi ​@Prasadug,

You can try like below, by copying the UDFs in SOLine RowUpdated event. This method isn’t the best, but I couldn’t find any other method where we could copy the UDFs.    

    public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
{
#region Event Handlers
public void SOLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated baseEvent)
{
baseEvent?.Invoke(cache, e);
SOLine row = (SOLine)e.Row;
if (row.BlanketNbr != null)
{
SOOrderEntry blOrder = PXGraph.CreateInstance<SOOrderEntry>();
blOrder.Document.Current = PXSelect<SOOrder, Where<SOOrder.orderType, Equal<Required<SOOrder.orderType>>,
And<SOOrder.orderNbr, Equal<Required<SOOrder.orderNbr>>>>>.Select(Base, row.BlanketType, row.BlanketNbr);
var AttributeAMBATLEN = blOrder.Document.Cache.GetValueExt(blOrder.Document.Current, "AttributeAMBATLEN");
if (AttributeAMBATLEN != null)
{
//blOrder.Document.Cache.SetValueExt(blOrder.Document.Current, "AttributeAMBATLEN", AttributeAMBATLEN.ToString());
Base.Document.Cache.SetValueExt(Base.Document.Current, "AttributeAMBATLEN", AttributeAMBATLEN.ToString());
}
}
}
#endregion
}

Please feel free to reach me if you have any questions! Good Luck,