Using Global Vars to Load N:N (Many-to-Many) Double Selects

I am trying to use global variables to load some double select menus, and I am having some issues.

I have 2 N:N fields in a form, both with double select menus. The first double select is loaded normally. The second double select is empty. The user is instructed to make selections in the first double select, then hit save on the form.

When the form is saved, I am going through the N:N table and saving the values to a global variable. I am then using that global variable to populate the second double select. The second double select is based on values from the first double select.

All of the above is working fine, except that I have to hit the Save button twice for the second menu to load.

My question is: on what Event in the form can I use to: reset the globals (currently using onApplicationInit), fetch the new values for the variables so that they can apply to the creation of the second menus. I have tried most of the Events, but have been unsuccessful. I always end up having to hit the save button twice. On the second save, it works properly.

Note that both sets of double select menus are N:N Relationships.

Thanks for any assistance on this!

I ended up doing a sc_commit_trans() then sc_redir() onAfterUpdate, and the menus respond properly. I don’t like the delay it causes, but my menus do work properly now.