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.

parent.dialog.close();

Any one can please help how to achieve this?

Thanks & Regards

Gaurav