Hide cross mark on UI page and show the page at the top

Harish74
Tera Expert

Hi there,

I created a UI page that displays Yes/No button. Based on the user input selection the actions gonna take place. But the user is still able to close the UI page using the "cross mark" without selecting any input. That should not happen. 

find_real_file.png

Please help me in removing that "cross mark" and also I want to place this UI popup at the top of page instead of center.

 

1 ACCEPTED SOLUTION

Hi,

You can use this code and it would show the confirm box with Yes/No and it comes in center

var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Confirmation');
dialog.setPreference('body', 'Is there a Cost impact?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
	
function doComplete() {
	callback(true);
}
	
function doCancel() {
	callback(false);
}

Output:

find_real_file.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

View solution in original post

13 REPLIES 13

Hi,

You can use this code and it would show the confirm box with Yes/No and it comes in center

var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Confirmation');
dialog.setPreference('body', 'Is there a Cost impact?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
	
function doComplete() {
	callback(true);
}
	
function doCancel() {
	callback(false);
}

Output:

find_real_file.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

Ankur, I placed the entire script in my OnLoad Client script. How can I retrieve the user input? 

find_real_file.png 

 

Hi,

are you using script I shared?

what input you want?

The script already has the callback method what will happen when yes is clicked; what will happen when no is clicked

var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Confirmation');
dialog.setPreference('body', 'Is there a Cost impact?');
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();

function doComplete() {
    // when user clicks Yes
    callback(true);
}

function doCancel() {
    // when user clicks No
    callback(false);
}

regards
Ankur

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

As you see in the above screen shot, I added the below line when user clicks Yes. But its not making the value true.

"g_form.setValue('u_cost_impact',true);"

It worked after commenting the callback line. So, the GlideModal glide_modal_confirm" you are calling , is this an OOB ?

 

It worked after commenting the callback line.