Skip to main content
Solved

Default Qty to Produce Value to 1.00 in Material Wizard 1 (AM300010) Screen and Required Quantity to 1.00 in Material Wizard 2 Screen (AM300020)

  • November 22, 2024
  • 2 replies
  • 31 views

Forum|alt.badge.img+2

Hi I have a requirement where I need to default the qty to produce to 1.00 in material wizard 1 screen which I have implemented as follows:
 

namespace PX.Objects.AM
{
  public class MatlWizard1_Extension : PXGraphExtension<PX.Objects.AM.MatlWizard1>
  {
    #region Event Handlers

    protected void AMProdItem_Selected_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated baseHandler)
    {

baseHandler?.Invoke(cache, e);
            var row = (AMProdItem)e.Row;
             if (row.Selected == true) // Only if the item is selected
        {
            row.QtytoProd = 1.0000m;
        }

    }


This works but when I select a record to be sent to Material Wizard 2 screen this grabs the value based on original logic. How can I make sure the value is set to 1.00 across both screens?

 

As a side note I have also tried implementing field defaulting event handler but this universally updates AMProdItem.QtytoProduce which is not required because only these 2 screens need to be updated.

Thank you!

Best answer by TharidhiP

Hi all, the only possible method I found was to default values in material wizard 1 screen, is the code given above. In order to populate 1.00 as the default value in required qty field in material wizard 2 I have used the code below.

 // Use RowSelected to update QtyReq when the row is selected or edited
        protected void AMWrkMatl_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            var row = (AMWrkMatl)e.Row;
            if (row == null) return;

            // Force QtyReq to 1.00 whenever a row is selected or edited
            row.QtyReq = 1.00m;
            sender.SetValue<AMWrkMatl.qtyReq>(row, 1.00m);

            PXTrace.WriteInformation("AMWrkMatl_RowSelected: Setting QtyReq to 1.00");
        }

Hope this helps!

View original
Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+2
  • Author
  • Pro I
  • 104 replies
  • Answer
  • December 2, 2024

Hi all, the only possible method I found was to default values in material wizard 1 screen, is the code given above. In order to populate 1.00 as the default value in required qty field in material wizard 2 I have used the code below.

 // Use RowSelected to update QtyReq when the row is selected or edited
        protected void AMWrkMatl_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            var row = (AMWrkMatl)e.Row;
            if (row == null) return;

            // Force QtyReq to 1.00 whenever a row is selected or edited
            row.QtyReq = 1.00m;
            sender.SetValue<AMWrkMatl.qtyReq>(row, 1.00m);

            PXTrace.WriteInformation("AMWrkMatl_RowSelected: Setting QtyReq to 1.00");
        }

Hope this helps!


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2776 replies
  • December 2, 2024

Thank you for sharing your solution with the community ​@TharidhiP!


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