spmodal confirm - How to change default button text ok/cancel

Ram102
Kilo Contributor

Experts,
I have a requirement to change the confirm default button text from (ok/Cancel) to (Submit/Attach) when submitting a record producer from Portal.
For Spmodal.open, we have the option to pass buttons parameter to show on the dialog, but I am not sure how we can pass it for spmodal.confirm.
Please let me know if you have any solution/workaround for this.

Thank you.

1 ACCEPTED SOLUTION

Hi,

Please use below code and check if it works for you.

Having your own widget to show as a popup gives you flexibility on what goes inside it.

Call g_user.showModalDialog - as per your requirement.

--> Write this in onLoad catalog client script
g_user.submitClicked = false;
g_user.showModalDialog = function(msg) {
		if(NOW.window) { //Service portal
			var shared = {};
			shared.message = msg;
			var popupOptions = {
				title: 'title_name',
				widget: 'id_of_the_widget_that_contains_what_should_be_there_in_popup',
				widgetInput: 'any inputs that need to be passed to the widget',
				shared: shared,
				footerStyle: {display:'none'}
			};

			if(! g_user.submitClicked) {
				g_user.submitClicked = true;
				var modalInstance = spModal.open(popupOptions).then(function() {
					g_form.submit();
				}, function() {
					g_user.submitClicked = false;
				});
			}
		} else {
			//Code to open popup in platform (you can use glide_confirm_standard)
		}
};

--> Write this in onSubmit catalog client script

if(g_user.submitClicked)
	return true;

return false;

View solution in original post

11 REPLIES 11

Ram102
Kilo Contributor

Please note, I am trying this in catalog client script. 

Hi,

Please use below code and check if it works for you.

Having your own widget to show as a popup gives you flexibility on what goes inside it.

Call g_user.showModalDialog - as per your requirement.

--> Write this in onLoad catalog client script
g_user.submitClicked = false;
g_user.showModalDialog = function(msg) {
		if(NOW.window) { //Service portal
			var shared = {};
			shared.message = msg;
			var popupOptions = {
				title: 'title_name',
				widget: 'id_of_the_widget_that_contains_what_should_be_there_in_popup',
				widgetInput: 'any inputs that need to be passed to the widget',
				shared: shared,
				footerStyle: {display:'none'}
			};

			if(! g_user.submitClicked) {
				g_user.submitClicked = true;
				var modalInstance = spModal.open(popupOptions).then(function() {
					g_form.submit();
				}, function() {
					g_user.submitClicked = false;
				});
			}
		} else {
			//Code to open popup in platform (you can use glide_confirm_standard)
		}
};

--> Write this in onSubmit catalog client script

if(g_user.submitClicked)
	return true;

return false;

Hi,

I posted an article on how to show custom popup when submitting a catalog in service portal. Please refer to it.

https://community.servicenow.com/community?id=community_article&sys_id=ceac0245db6954505129a851ca961...

Thanks

Is there any way to remove the extra line for the portal view?
find_real_file.png

Hi,

In the widget for the div with class="modal-footer", also add a style attribute as given below:

style="border-top: none"

<div class="modal-footer" style="border-top: none">

Thanks