3

When I close a SysQueryForm (by clicking on Ok button), a system generated dialog box appears on the form as shown below:- enter image description here

I am writing a unit test to close this dialogue box but when I try to close the sysbox form by using the X++ code below:-

using (SysBoxFormAdaptor sysBoxForm = SysBoxFormAdaptor::attach())
{
    sysBoxForm.CloseCtrl().click();
}

I am getting the following error:-

Cannot access form CPool id 3: topmost form is SysBoxForm id 181<\error>

There are open forms on the client: {"CPool (3)", "SysBoxForm (181)"}<\error>

To give a context, CPool is the form on which selecting a button opens a SysQueryForm and after selecting a criteria on the SysQueryForm for a particular table due to some join issue this system dialogue comes which cannot be fixed as of now.

I have tried some other ways as well but they too end up throwing the same error.

So the issue is that SysBoxForm is not closing.

Since this is a system generated (kernel level) dialogue, does anyone know how to close it?

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
zester
  • 165
  • 3
  • 12

1 Answers1

2

So after further debugging I found out that two SysBoxForms are getting opened, one on top of the other. So closed them by attaching SysBoxFormAdaptor twice and it worked:-

using (SysBoxFormAdaptor sysBoxForm = SysBoxFormAdaptor::attach())
{
    sysBoxForm.CloseCtrl().click();
}
using (SysBoxFormAdaptor sysBoxForm = SysBoxFormAdaptor::attach())
{
    sysBoxForm.CloseCtrl().click();
}

This was the reason I was getting the error that a SysBoxForm is open.

zester
  • 165
  • 3
  • 12