We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How close UI Page Dailogue window?

surajsironi
Kilo Sage

Hi,

 

UI Page not working in Agent Workspace. how to close  dialogue window in Agent workspace

 UI Page HTML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<table width="100%" height="100%">
<tr>
<td>

<g:ui_multiline_input_field name="dial_comments" label="Additional comments" value="${jvar_comments_text}" mandatory="true" />

<label style="display: block;">Contact Type</label>
<g:ui_choicelist name='HoldReason' label="Contact Type" table='incident' field='contact_type'/>

<label style="display: block;">Business Service</label>
<g:ui_reference name="input_business_service" table="cmdb_ci_service" query="nameNOT LIKEBlackberry" label="Business service"/>


</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>

<tr id="dialog_buttons">
<td colspan="5" align="right">
<g:dialog_buttons_ok_cancel ok="return validateComments()" ok_type="button" cancel_type="button" />
</td>
</tr>

</table>
</j:jelly>

client script:

function validateComments() {
var businessservice=gel("input_business_service").value;
var comments = gel("dial_comments").value;
var contacttype=gel("HoldReason").value;

comments = trim(comments);
if ((comments == "" )||(businessservice=="")||(contacttype==""))

{
alert("Please Fill fields to submit the dialog.");
return false;
}

GlideDialogWindow.get().destroy();
g_form.setValue("comments", comments);
g_form.setValue('business_service',businessservice);
g_form.setValue('contact_type',contacttype);

}

how to fix OK, Cancel buttons issue.

 

 find_real_file.png

 

12 REPLIES 12

harshav
Tera Guru

Comment out the following script:

<tr id="dialog_buttons">
<td colspan="5" align="right">
<g:dialog_buttons_ok_cancel ok="return validateComments()" ok_type="button" cancel_type="button" />
</td>
</tr>

 

Now comment out the whole client script:


function validateComments() {
var businessservice=gel("input_business_service").value;
var comments = gel("dial_comments").value;
var contacttype=gel("HoldReason").value;

comments = trim(comments);
if ((comments == "" )||(businessservice=="")||(contacttype==""))

{
alert("Please Fill fields to submit the dialog.");
return false;
}

GlideDialogWindow.get().destroy();
g_form.setValue("comments", comments);
g_form.setValue('business_service',businessservice);
g_form.setValue('contact_type',contacttype);

}

 

Thanks

Hi Harsha,

Thanks for reply, i tried with below script. still window not going destroyed. 

HTML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div class="container">
<div class="row">
</div>
<div class="row">
<form>

<g:ui_multiline_input_field name="dial_comments" label="Additional comments" value="${jvar_comments_text}" mandatory="true" />

<label style="display: block;">Contact Type</label>
<g:ui_choicelist name='HoldReason' label="Contact Type" table='incident' field='contact_type'/>

<label style="display: block;">Business Service</label>
<g:ui_reference name="input_business_service" table="cmdb_ci_service" query="nameNOT LIKEBlackberry" label="Business service"/>

<g:dialog_buttons_ok_cancel ok="return validateComments()" cancel="return cancel()" ok_type="button" cancel_type="button" />
</form>
</div>
</div>
</j:jelly>

 

Client :

function validateComments() {
var businessservice=gel("input_business_service").value;
var comments = gel("dial_comments").value;
var contacttype=gel("HoldReason").value;

comments = trim(comments);
if ((comments == "" )||(businessservice=="")||(contacttype=="")){
alert('test');
return false;
}
GlideDialogWindow.get().destroy();
g_form.setValue("comments", comments);
g_form.setValue('business_service',businessservice);
g_form.setValue('contact_type',contacttype);


return true;
}

function cancel()
{
g_modal.showFrame(false);
return false;
}

do you have any solution for it. 

Swapnil Soni1
Giga Guru

Hi,

Please try this to close the dialog box

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

 

Client :

function validateComments() {
var businessservice=gel("input_business_service").value;
var comments = gel("dial_comments").value;
var contacttype=gel("HoldReason").value;

comments = trim(comments);
if ((comments == "" )||(businessservice=="")||(contacttype=="")){
alert('test');
return false;
}
GlideDialogWindow.get().destroy();
g_form.setValue("comments", comments);
g_form.setValue('business_service',businessservice);
g_form.setValue('contact_type',contacttype);


return true;
}

function cancel()
{
g_modal.showFrame(false);
return false;
}

 

Please mark correct or helpful.

Thanks

Swapnil Soni