Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Custom UI Page Pop up is not working

Munny1
Tera Expert

Hi @Ankur Bawiskar 

Need help below code is not working as expected


UI page script

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">
	<g:dialog_notes_ok_cancel
		dialog_id="flag_reason"
		textarea_id="flag_reason_text"
		textarea_label="${gs.getMessage('Reason')}"
		textarea_label_title="${gs.getMessage('A reason is required to cancel this flag')}"
		textarea_name="flag_reason_text"
		textarea_onkeyup="enableButton()"
		textarea_onchange="enableButton()"
		textarea_style="height:auto; width: 100%; resize: vertical;"
		textarea_title="${gs.getMessage('Enter the reason here')}"
		ok=""
		ok_action="cancelflag"
		ok_id="change_confirm_ok_btn"
		ok_title="${gs.getMessage('Cancel flag')}"
		ok_type="button"
		ok_style_class="btn btn-primary disabled"
		cancel_title="${gs.getMessage('Close the dialog')}"
	/>
</j:jelly>

Client script :

function cancelflag() {
	var textArea = $("flag_reason_text");
	if (textArea)
		moveToCancel(textArea.value.trim());
}

(function() {
	$("flag_reason_text").focus();
})();



UI action script:

 

onclick : loadConfirmDialog();

var flagreason;

function loadConfirmDialog() {
	var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
	flagreason = new dialogClass("flag_reason", false, 648, 250);
	flagreason.setTitle(new GwtMessage().getMessage("Cancel flag"));
	flagreason.render();
}

function moveToCancel(notes) {
    g_form.setValue("comments", notes);
    flagreason.destroy();
    gsftSubmit(null, g_form.getFormElement(), "u_flag");

}

if (typeof window == 'undefined')
    setRedirect();

function setRedirect() {
    current.update();
    action.setRedirectURL(current);
}


 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Munny1 

so what's not working?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Dialog window is not appearing. When i click on Ui action nothing is happening . i missed something?

@Munny1 

are you calling ui page correctly?

you are in global scope or custom scope?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Global scope
Yes i have given correct name . I am trying in PDI
On service offering table i am trying