Solved

Update dependent fields on Filter view for custom processing screen not working

  • 6 August 2021
  • 5 replies
  • 289 views

Userlevel 3
Badge +1

I have a custom processing screen and would like to clear out values of other fields on my filter based on a combobox changing.  I’ve have CommitChanges set to true on my combobox but can’t get the text box values to clear.  

I can set a breakpoint and see that the values are changing to null but they stay on the screen until I change the combobox back to Pallet then back to Truck and back to Pallet again.  But the first time the UI doesn’t show the change.

Here is my FieldUpdated logic: 

 

 

        protected virtual void _(Events.FieldUpdated<PMTaskToAssignFilter, PMTaskToAssignFilter.assign> e) {

            PMTaskToAssignFilter row = e.Row;

            if (row.Assign != AssignTypes.Truck) { 

                row.DeliveryNumber = null;

                row.TrailerNumber = null;

            }

        }

icon

Best answer by Naveen Boga 9 August 2021, 06:31

View original

5 replies

Userlevel 7
Badge +17

Hi @rjean09  Okay!! Thanks for sharing an update.

Userlevel 3
Badge +1

@Naveen B Thank you for the suggestions, however, values continue to not clear on the fieldupdated event.  However, I tried changing Assign combobox to Truck/Pallet mutually exclusive checkboxes and now when I select the Pallet checkbox DeliverNumber and TrailerNumber clear no problem.  Funny thing about this is that the original screen mock-up provided to me showed check boxes and I made the call to use a dropdown.  So, for now, problem solved in a roundabout way.

Userlevel 7
Badge +17

@rjean09 I’m NOT sure, why this is NOT working, but you can try with below provided code and verify

protected virtual void _(Events.FieldUpdated<PMTaskToAssignFilter, PMTaskToAssignFilter.assign> e) 
{

PMTaskToAssignFilter row = e.Row;

if ( row != null && row.Assign != AssignTypes.Truck)
{
e.Cache.SetValueExt<PMTaskToAssignFilter.deliveryNumber>(e.Row, string.Empty);
e.Cache.SetValueExt<PMTaskToAssignFilter.trailerNumber>(e.Row, string.Empty);
}
}

Above code should work but  Incase above code is NOT working, please use code and check…

protected virtual void _(Events.FieldUpdated<PMTaskToAssignFilter, PMTaskToAssignFilter.assign> e) 
{

PMTaskToAssignFilter row = e.Row;

if ( row != null && row.Assign != AssignTypes.Truck)
{
//Assuming below fields are just text fields.
row.DeliveryNumber = string.Empty;
row.TrailerNumber = string.Empty;
e.Cache.Update(row);
}
}

Userlevel 3
Badge +1

Hi @Naveen B 

Yes, Commit Change = True for the Assign field.  Tried the above changes but still does not change the values on the UI without toggling Assign an additional time between Truck/Pallet.

Userlevel 7
Badge +17

Hi @rjean09  Code looks good to me and it should work, but still we can do few modifications in your code. Please find the code below.

  • assuming that you have Commit Change = True at .aspx level for the assign field.
protected virtual void _(Events.FieldUpdated<PMTaskToAssignFilter, PMTaskToAssignFilter.assign> e) 
{

PMTaskToAssignFilter row = e.Row;

if ( row != null && row.Assign != AssignTypes.Truck)
{
//Assuming below fields are just text fields.
row.DeliveryNumber = string.Empty;
row.TrailerNumber = string.Empty;
}
}

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