Skip to main content
Question

Linking Dates from Custom Date Field on PO Screen to Custom Date Field on PO Line


Hi All

I’m totally new to customizations, I followed a few guides online and was able to add custom fields on our PO screen (see screenshot attached).

What I would now like to accomplish is linking dates on the document section of the PO screen with the details section of the PO screen, meaning when a date field is populated on the document section the corresponding date field in the details section is populated as well. Similar to how the ‘Date’ and ‘Promised On’ fields on the document section are linked to the ‘Requested’ and ‘Promised’ fields in the detail section.

I have two custom fields ‘ETA GY’ and ‘Back Order Date’ on the document section and would like them to be linked to the ‘ETAGY’ field and ‘Back Order Promise Date’ fields (also custom fields) in the details section respectively. Also, the ‘Back Order Promise Date’ field can only be populated if the ‘Back Order’ checkbox is ticked (another custom field).

Any input is greatly appreciated.

Thanks

Amit

Custom date fields and checkbox in red to be linked, similar to the date fields in green
 

 

5 replies

Forum|alt.badge.img+1

@asingh 

You can achieve the requirement by using event handlers

Below is a sample implementation using the RowUpdated event on the POOrder graph.

public class POOrderEntryExt : PXGraphExtension<POOrderEntry>
{
    protected void POOrder_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
    {
        var row = (POOrder)e.Row;
        var rowOld = (POOrder)e.OldRow;

        if (!sender.ObjectsEqual<POOrderExt.usrETAGYDate, POOrderExt.usrBackOrderDate>(row, rowOld))
        {
            foreach (POLine line in Base.Transactions.Select())
            {
                var lineExt = line.GetExtension<POLineExt>();

                lineExt.UsrETAGY = row.GetExtension<POOrderExt>().UsrETAGYDate;

                if (lineExt.UsrBackOrder == true)

                    lineExt.UsrBackOrderPromiseDate = row.GetExtension<POOrderExt>().UsrBackOrderDate;


                Base.Transactions.Update(line);
            }
        }
    }
}

you can also consider using the FieldDefaulting event on the detail lines.

Thankyou


  • Author
  • Freshman I
  • 7 replies
  • April 14, 2025

Hi ​@Saikrishna V thank you for your input and apologies for the late reply. After trying your suggestion, the following error was shown after I tried to ‘Publish Current Project’ from the ‘Publish’ menu:

Error shown after trying to ‘Publish Current Project’
​​​

For context, these are the steps I took:

  1. Opened the customization project.
  2. Opened the customized screen.
  3. Clicked on ‘Form: Document’, clicked ‘Events’ tab, selected ‘RowUpdated’, clicked ‘ADD Handler’ and selected ‘Keep Base Method’ (see screenshot attached).
    Steps Taken

     

  4. Inserted information and changed the data fields to match local instance.

I’m not sure if any of what I did was correct, but this sums up what was done and where it is now.

Appreciate any guidance / suggestions.

Thanks

Amit


Forum|alt.badge.img+1

Hello ​@asingh 

Thanks for the update, 

To fix this, try the below change — instead of using cache, use sender in the method signature and try package publish again.

// Original (causing issue)
protected void POOrder_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)

// Corrected version
protected void POOrder_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)

 

Thanks Sai
 


  • Author
  • Freshman I
  • 7 replies
  • April 17, 2025

Hi ​@Saikrishna V the customization was successfully published, but unfortunately did not have any effect on the screen.

Thanks

Amit


Forum|alt.badge.img+1

@asingh 

there is a small error: the keyword virtual is missing in syntax

protected virtual void POOrder_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e) {}

and also make sure to declare CommitChanges=true in aspx.

Thanks


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings