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

Thank you. I will try this.

Anil Shewale
Mega Guru

Hi 

You can't alter button names in confirm box, alternatively you can create your own ui page and name buttons as you like

https://community.servicenow.com/community?id=community_question&sys_id=83b52acedbaf2b009a64e15b8a96...

refer the xiaix post:

https://community.servicenow.com/community?id=community_question&sys_id=f413f7b3dba6df400be6a345ca96...

https://community.servicenow.com/community?id=community_question&sys_id=6bf08ba5db98dbc01dcaf3231f96...

 

If it help mark helpful or correct 

Thanks and regards

Anil