Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to save the field values from Popup window

immanuel1
Mega Contributor

Hi All,

Having a incident requester catalog form to raise a incident .when a requester doesn't have proper Timezone ,timezone field dropdown Popup window should come after fill the popup field value should save in "sys_user" table .for that i have written below code ,I am getting pop up window ,if i am selecting the values are not saving in "sys_user" table.

can any help me please.

Getting popup window:-

find_real_file.png

UI Page :-

-------------

HTML:-

find_real_file.png

find_real_file.png

Catalog client script:

------------------------

function onSubmit()

{

    //Type appropriate comment here, and begin script below

var   time;

var requested_for = g_form.getReference('caller_id');

time = requested_for.time_zone;

//alert(time);

if(time)

{

return true;

}

else

{

alert('your timezone is empty please fill the appropriate timezone');

var dialog = new GlideDialogWindow("Timezone");  

  dialog.setSize(700,400);  

dialog.setTitle("Select the user time zone:");    

GlideDialogWindow.get().destroy(); //Close the dialog window

                      g_form.setValue("u_comments", comments);

                      g_form.save();

dialog.render(); //Open the dialog  

//var tz = gel("ddlTypes").value;

//alert(tz);

return false;

}

}

Please help me where i have done mistake.

Thank,

Immanuel

1 REPLY 1

tobrien
Kilo Guru

Immanuel --



The most obvious problem is that you are attempting to set the value of 'u_comments' from a variable named "comments" that is not defined anywhere that I can see.



Additionally, retrieving items from a dialog box is a bit more complex than you have scripted...   Here's the relevant Wiki ==>




http://wiki.servicenow.com/index.php?title=Displaying_a_Custom_Dialog#gsc.tab=0