Javascript and Dialogs (Parent - Child - Grand Child)

I have some special use cases and am having issues with the Dialog JS object.

When I use Dialog.open from a Form to open a Custom Dialog, things work great. However, when I have use cases, where I open a Dialog from a Child Form, I get issues with the object references.

My Scenario:

  • I have Form1 in "full screen".
  • I have Form2 opened from a List/Library control on Form1.
    ** Note the if I do Dialog.getArgs() in console I references Form2
  • I have a Custom Dialog (open with Dialog.open(....) from a Button on Form 2.
    ** If I do Dialog.getArgs() in console now, it references the Custom Dialog
  • In the JS on Custom Dialog, I want to "talk" to the JS on Form 2, but when I do parent. I get the JS on Form 1

I have tried to window.opener from the Custom Dialog, but the value is always null.

Again, my question is: From the Custom Dialog, how do I access the JS in Form2?

Dear @sphilson,
Try adding the following line to Form 2:
window.top.fd2 = fd;

Then you can access it from Form 3, with the following code:
window.top.fd2.field('Title').value