HI all I am trying to make sure the form is opened only once.For my case where i need to close the old form and open the new form. i tried using the following code but it opens the both forms, please help me in correcting the logic.
#define.CACHE_OWNER('CsPsqProdTableAttribConfig')
#define.CACHE_KEY_INSTANCE('Instance')
FormRun existingForm()
{
if (infolog.globalCache().isSet(#CACHE_OWNER, #CACHE_KEY_INSTANCE))
{
return infolog.globalCache().get(
#CACHE_OWNER, #CACHE_KEY_INSTANCE);
}
return null;
}
void registerThisForm()
{
infolog.globalCache().set(#CACHE_OWNER, #CACHE_KEY_INSTANCE, this);
}
boolean isAlreadyOpened()
{
return existingForm() ? !existingForm().closed() : false;
}
void closeExistingForm()
{
existingForm().close();
}
if (isAlreadyOpened())
{
closeExistingForm();
this.activate(true);
}
else
{
registerThisForm();
}