Forum Discussion
Hi Cogres,
Senario:
I am using aras innovator 11 SP 12. I have Itemtype A and Itemtype B. Created relationship of Itemtype A in Itemtype B. In related_id property of relationship Itemtype I have wrote one client method for "OnSearchDialog" event. Method is totally running fine. Now I have to put one validation, on satisfying false condition I want to close Search Dialog box dynamically through code. I have tried following different option to close Dialog but it is not working
1.) parent.dialog.close();
2.) this.args.dialog.close();
Following is my method that check and validate condition and execute code
----Method Code(Client Side)----
bool Result = false; //this is getting initialized dynamically. Currently assuming it has false value
If(Result)
{
//Do Something
}
else
{
close(); //Need to close Search dialog box on satisfying false condition. Tried above options too.
}
Hi Gaurav,
Thanks for the clarification!
Since you did not open the dialog from your own custom code, closing it might be a bit trickier. I've played around with it a little bit, but the only thing I found was the kind of hacky
document.getElementsByTagName("dialog")[0].close();
It worked for me in a setup similar to yours (note: I tested this on Innovator 12.0). My onSearchDialog method simply contained
alert("hi");
document.getElementsByTagName("dialog")[0].close();
and when clicking "Pick related", it opened the dialog, alerted "hi" and then closed the search dialog.
Obsiously this approach is not very robust, but maybe it can serve as a starting point for you? Maybe you can find a way to uniquely identify the dialog you opened in your setup (document.getElementsByTagName("dialog")[0] makes me feel kind of uneasy), but I couldn't find anything else so far.
Maybe someone else knows a more solid approach.
Cheers,
C