Testing g_form in Chrome console

Giri6
Tera Expert

Is it possible to invoked methods on g_form in the console of chrome? I tried and it did not find the object. Wondering if there is any wrapper or  in anyway. Appreciate it.

10 REPLIES 10

Brian Lancaster
Tera Sage

You could put console.log around it.  So something like console.log(g_form.getValue('variablename'));

Giri6
Tera Expert

Thanks. Somehow it did not work before. I am able to execute the following code.

obj = g_form.getReference('caller_id');

obj.email.

I can get sysid of  caller's department . Is it possible to get department name? For that I need to use again g_form.getReference(). But how does it knows  this sysid is for department table.

I am assuming that getReference only works for field that exists on form and it is reference field with magnifyng lense. I just want to confirm. Appreciate it.

you could try obj.deparment.getDisplayValue().  However that may not work.  Your best bet is to use a refence field the points to department table and then doing a g_form.setValue(obj.department).  Since it is a reference filed it will display the name.

Giri6
Tera Expert

I tried g_form and it worked one time in Chrome console. Now both Firefox and chrome  shows the following as soon as I type g_form on console command. It is easy to test with the console. Any idea on how to make it all the time?

 I thought g_form is global variable and it should be avilable. I am sure it worked one time and tried couple of times to get the data using get_reference()

 

ReferenceError: g_form is not defined