How to close relationship search dialog box dynamically?

Hi Team,

I have custom result binding code on 'OnSearch' event. On return of result if it is true it works fine but on false I want to close search dialog box that appear in relationship on click of pick related dynamically. 

I tried following method but it is not working.


Any one can please help how to achieve this?

Thanks & Regards


  • Hi Gaurav,

    your problem sounds quite interesting. Unfortunately, I don't quite understand it completely. Could you provide some more details about your setup, please? Do you have a client event onClick of the "Pick related" button in the standard relationship grid? Could you share/explain some of the code that you implemented, as well?

    If you opened the search dialogue with custom code (and with some onSearchDialog event from a sourcePropertyName parameter that contains your business logic) it should be straightforward to close that window in your custom code as well. Seeing as you have this problem, I assume your setup is different, which is why I'm asking :).



  • Hi Cogres,


    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



       //Do Something




       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


    It worked for me in a setup similar to yours (note: I tested this on Innovator 12.0). My onSearchDialog method simply contained


    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.