Need Dot Walking script for pop up window,

malaisamy1
Kilo Contributor

Hi Guys,

i have a scenario where i want "dot walking" script for pop up window.

I have written a script for pop up window as below. For That i have used onload client script.

Script:

  if(g_form.getValue('d_type')=='Expected Default'){

  var a = '<tTable Name>';(this is different table . I am bringing in form as a pop up.. )

  var dialog = new GlideDialogForm('Please Enter RCA Details',a);

  dialog.setSysID(-1);                                                                                                                                                                        

                              dialog.setLoadCallback(function(iframeDoc) {          

                              var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;

                                                                           

                              dialogFrame = null;

                              });

                              dialog.setDialogSize(1200,800);

                              dialog.render();

  }

   

My requirement is,

i have two different form. within one form i am bringing another form as a popup. I need few values from the parent form to the pop up form as soon as the pop up form opened.

is there way to do this using dot walking or any other method. ?

Thanks in advance.

Malaisamy J

6 REPLIES 6

oharel
Kilo Sage

I think you want this line above the dialog.render() statement:


var sysID = g_form.getUniqueValue();


dialog.addParm('sysparm_query','parent=' + sysID);


where "parent" is the current incident, or parent.


Then add a display BR on your RCA table (the target table in my case) to take the values from the parent incident.



Or, do this: as per Pass values when calling a GlideDialogForm with a UI Action


dialogFrame.g_form.setValue('target field', source field);



function onLoad() {


  var inc = g_form.getUniqueValue(); //the form sys_id


  var desc = g_form.getValue('description'); //field we are passing to the pop up



  if(g_form.getValue('d_type')=='Expected Default') {



  var dialog = new GlideDialogForm('Please Enter RCA Details', 'u_rca');// setWPField);


  dialog.setSysID('-1'); //Pass in -1 to create a new record


  dialog.addParm('sysparm_form_only', 'true'); //Remove related lists


  dialog.addParm('sysparm_query','parent=' + inc); //Set parent sys id in rca



  //Callback inserts values into the Computer record after data are returned from the server  


  dialog.setLoadCallback(function(iframeDoc) {


  var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;



  dialogFrame.g_form.setValue('description', desc); //passing current description to the pop up


  dialogFrame = null;


  });


  dialog.setDialogSize(1200,800);


  dialog.render();


  }  


}



Let me know if that helps.


Harel


Hi harel,



You are really amazing... IT works perfectly..Thank you so much for the help.



Malaisamy J


Sure.


Just mark it as correct of you can.



Harel


Hi Harel,



One small issue,


If i try to bring reference field value form parent to pop up window it gives me sys id value. Is there a way to rectify this issue to get the original value?



Thanks in Advance.