Solved

Extra eyes on my customization attempt appreciated - RowSelected handler within POOrderEntry

  • 14 June 2023
  • 4 replies
  • 62 views

First, I’m not a developer by trade.  However, I like challenges.  Requirements: create three UDFs within Purchase Orders (Estimation Notes (text), Warehouse Last Review Date (date), and Warehouse Shipping Notes (text)).  Two of these fields (the “Warehouse” fields) must be modifiable regardless of the state/status of the NORMAL type PO.  The third field, Estimation Notes is only used during PO creation and not modified afterwards.  All of these are needed within the Details Grid.  One existing field, POLine.PromisedDate is needs to be modifiable as described for the other fields.

I created the three fields within the Details Grid. I then created an extension named mrROExtension in the workflow.  I added the all of the UDFs to the workflow extension.  I then created the Code graph managing the RowSelected base handler.  After verification and compilation, no errors.  Upon publishing to my local instance/tenant, all appears to work as desired.

I would greatly appreciate Community members reviewing the project and code and let me know if there is anything I should have done differently or that appears potentially concerning.

Code snippet:

namespace PX.Objects.PO
{
  public class POOrderEntry_Extension : PXGraphExtension<PX.Objects.PO.POOrderEntry>
{
#region Event Handlers
protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(cache, e);
var row = (POLine)e.Row;
PXUIFieldAttribute.SetEnabled<POLineExt.usrWHShipNotes>(cache, row, true);
PXUIFieldAttribute.SetEnabled<POLineExt.usrWHLastReviewDate>(cache, row, true);
PXUIFieldAttribute.SetEnabled<POLine.promisedDate>(cache, row, true);
}
#endregion
}
}

Attached the project export here as well.

Thanks in advance!!

icon

Best answer by Naveen Boga 15 June 2023, 10:46

View original

4 replies

Userlevel 7
Badge +17

Hi @mrhoades  I have reviewed the code and workflow changes that you made. It all looks good.

The only minor change I can suggest is to add the NULL check for the row and allow cache updates irrespective of the Purchase Order Statuses.

 

 

 public class POOrderEntry_Extension : PXGraphExtension<PX.Objects.PO.POOrderEntry>
{
#region Event Handlers
protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(cache, e);
var row = (POLine)e.Row;
if (row != null)
{
Base.Document.Cache.AllowUpdate = true;
cache.AllowUpdate = true;
PXUIFieldAttribute.SetEnabled<POLineExt.usrWHShipNotes>(cache, row, true);
PXUIFieldAttribute.SetEnabled<POLineExt.usrWHLastReviewDate>(cache, row, true);
PXUIFieldAttribute.SetEnabled<POLine.promisedDate>(cache, row, true);
}
}
#endregion
}

 

Thanks for your help Naveen.  I’ll update the code to address the Null value check you recommend.  Having the ability to put things before the Community and have a sanity check before I really make a mess is great to have.

 

Michael

Userlevel 7
Badge +17

@mrhoades  Understood!! But you did it perfectly!!

Naveen,

I have created another project to allow UDFs within the PO302000 form to not only be presented, but to remain modifiable regardless of the Type or Status of the Purchase Receipt. I modified the workflow for PO302000 (Purchase Receipts) as follows:

> Workflow types: RT, RX, and RN "extended" to include the UDFs I had created in this project previously.

> For each workflow type, I modified the States of "Balanced" and "Released" to include the UDFs I need to remain modifiable throughout the workflow of the documents.

> I then created the Code graph extension for POReceiptEntry. I validated the code and cleared up all error warnings. I then published to my localDB of Acumatica and tested. No problems seen.

 

I would appreciate your time to review the project (attached) and let me know if you see anything I should address. I made sure to include the handling of the Null value for RowSelected as you had recommended in my other project you kindly reviewed for me!

 

Code is:

{
  public class POReceiptEntry_Extension : PXGraphExtension<PX.Objects.PO.POReceiptEntry>
  {
    #region Event Handlers
        protected void POReceiptLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
        {
            baseHandler?.Invoke(cache, e);
            var row = (POReceiptLine)e.Row;
            if (row != null)
            {
                Base.Document.Cache.AllowUpdate = true;
                cache.AllowUpdate = true;
                PXUIFieldAttribute.SetEnabled<POReceiptLineExt.usrPORecptMainGridRoomNbr>(cache, row, true);
                PXUIFieldAttribute.SetEnabled<POReceiptLineExt.usrPORecptMainGridMACAdd>(cache, row, true);
                PXUIFieldAttribute.SetEnabled<POReceiptLineExt.usrPORecptMainGridIPAddress>(cache, row, true);
             }
         }

        protected void POReceiptLineSplit_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
        {
            baseHandler?.Invoke(cache, e);
            var row = (POReceiptLineSplit)e.Row;
            if (row != null)
            {
                Base.Document.Cache.AllowUpdate = true;
                cache.AllowUpdate = true;
                PXUIFieldAttribute.SetEnabled<POReceiptLineSplitExt.usrPORecptLnDetSplitRoomNbr>(cache, row, true);
                PXUIFieldAttribute.SetEnabled<POReceiptLineSplitExt.usrPORecptLnDetSplitMACAdd>(cache, row, true);
                PXUIFieldAttribute.SetEnabled<POReceiptLineSplitExt.usrPORecptLnDetSplitIPAdd>(cache, row, true);
            }
        }
    #endregion
    }
}

 

Respectfully,

Mike

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved