Solved

Checkbox FieldUpdated event does not work correctly

  • 20 June 2021
  • 2 replies
  • 352 views

Userlevel 2
I have 4 checkboxes and if I select any the others must be deselected. I'm using each one's FieldUpdate property, but it only works with Internal Budget with Vendor # 1, # 2, # 3 and # 4 not working.
I show an example of how I am using the Field Updated event.

InternalBudget FieldUpdated

Vendor_1 FieldUpdated

 

Enable commit changes property for each field but only works with InternalBudget. Anyone who can help me please?
icon

Best answer by eddiedaco 20 June 2021, 08:54

View original

2 replies

Userlevel 7
Badge +17

Hi @eddiedaco 

Below is the sample code for…..If we select one checkbox to deselect the other selected automatically… 

 

  protected virtual void SOOrder_Checkbox1_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
SOOrder row = e.Row as SOOrder;
if (row != null)
{
SOOrderExt rowExt = row.GetExtension<SOOrderExt>();
if (rowExt.Checkbox1 == true)
{
rowExt.Checkbox2 = false;
rowExt.Checkbox3 = false;
rowExt.Checkbox4 = false;
}
}
}

protected virtual void SOOrder_Checkbox2_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
SOOrder row = e.Row as SOOrder;
if (row != null)
{
SOOrderExt rowExt = row.GetExtension<SOOrderExt>();
if (rowExt.Checkbox2 == true)
{
rowExt.Checkbox1 = false;
rowExt.Checkbox3 = false;
rowExt.Checkbox4 = false;
}
}
}
protected virtual void SOOrder_Checkbox3_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
SOOrder row = e.Row as SOOrder;
if (row != null)
{
SOOrderExt rowExt = row.GetExtension<SOOrderExt>();
if (rowExt.Checkbox3 == true)
{
rowExt.Checkbox1 = false;
rowExt.Checkbox2 = false;
rowExt.Checkbox4 = false;
}
}
}
protected virtual void SOOrder_Checkbox4_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
SOOrder row = e.Row as SOOrder;
if (row != null)
{
SOOrderExt rowExt = row.GetExtension<SOOrderExt>();
if (rowExt.Checkbox4 == true)
{
rowExt.Checkbox1 = false;
rowExt.Checkbox2 = false;
rowExt.Checkbox3 = false;
}
}
}

Userlevel 2

Thanks @Naveen B for the answer. I resolve the problem using the new event declaration.

 

    protected void _(Events.FieldUpdated<CEBidLeveling, CEBidLeveling.internalBudgetChecked> e)
    {
      var row = (CEBidLeveling)e.Row;
  
      if(row.InternalBudgetChecked==true)
      {
        row.Vendor_1Checked =false;
        row.Vendor_2Checked = false;
        row.Vendor_3Checked = false;
        row.Vendor_4Checked = false;
      }
    }

and set the commit changes property = true.

 

for some reason my acumatica version doesnt recognize the normal event declaration.

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