Try it in the Sales Order form in the OnOpen trigger, no matter in the beginning or in the end of the trigger. First piece of code is fine. If I change the SETFILTER line with the SETVIEW line so that the code become:
FILTERGROUP(2)
SETVIEW(…)
FILTERGROUP(0)
This is expected to have the same behaviour as the first piece of code, but it is not. The filter is set, but it is visible and removable.
If I use the second piece of code, it seems to be OK, but still I’m worried, because theoretically it should do something else.