3

I have a custom DAC field bound to a checkbox, but when I update the value of the field within code:

SOOrderExtension orderExt = PXCache<SOOrder>.GetExtension<SOOrderExtension>(row);
orderExt.UsrSignatureRequired = true;

the checkbox check is not updated on the UI. First I tried adding this line in the FieldUpdated event because this has worked for me before:

Base.Document.Update(row);

That didn’t work. Then I tried a suggestion I found on StackOverflow that forces a save and cache refresh, but my row (SOOrder) can’t save yet due to some validation rules, so that didn’t work. I think I need some kind of callback to the client to tell the UI to update itself, but usually this happens through events of bound fields. Suggestions?

Using v6.10.1219

Tony Lanzer
  • 281
  • 1
  • 15
  • From where you are trying to update(set true) the checkbox? If you want to update Checkbox when modifying another field on Screen, make sure that the field has 'CommitChanges=true' so it triggers evenHandlers. – cbetabeta Oct 03 '17 at 16:58
  • I am updating the value in another field's FieldUpdated event handler. When that value changes, I want to check the checkbox according to its value. The event is being triggered successfully. – Tony Lanzer Oct 03 '17 at 17:08

1 Answers1

2

A colleague suggested I use cache.SetValueExt<>() instead:

cache.SetValueExt<SOOrderExtension.usrSignatureRequired>(row, true);

and now it’s updating the checkbox check for me. SetValueExt must perform the callback on its own somehow. I guess I need to remember to use each of these methods in the appropriate situation.

Tony Lanzer
  • 281
  • 1
  • 15