Monday, May 15, 2017

FormRun.wait, Box and ChangeCompany - a poor cocktail

I have had some code like this (simplified for the purpose of the example):
    formRun = new FormRun(...);

If you run this code and manually change company while the form is open and "waiting", the call to Box will make the system freeze up. I have reported this as a bug, but it is not accepted to be fixed.

The workaround, or you could argue proper solution, is to add an event handler for formRun.lifecycleHelper().StageChanging and run the Box code when the stage of the form changes to "Closing". That way Box is called before the form is entirely closed and the company account is changed, and then Box runs all right.