populate a on submit popup in Service Portal

Srinivas Tanne1
Tera Contributor

I would like to have a on submit popup when i click on "Submit" button, so that if i click on "Yes" the form will be submitted else form will stay on the same page.

3 REPLIES 3

Ankita19
Tera Guru
Tera Guru

Check below:

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

 

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

 

If it helps, please mark Correct and 👍 Helpful.

palanikumar
Mega Sage

You can create a Client script with the following

UI Type = Mobile / Service Portal or All

Type = OnSubmit

Script

function onSubmit() {
   //Type appropriate comment here, and begin script below
	if(!confirm("Are you sure you want to submit the form?")){
		return false;
	}
   
}
Thank you,
Palani

Voona Rohila
Kilo Patron
Kilo Patron

Hi Srinivas

You can use confirm method in your onsubmit client script.

https://servicenowguru.com/scripting/client-scripts-scripting/javascript-popup-boxes-servicenow/#:~:...

If you want this only when user uses 'submit' button then use below logic.

var action = g_form.getActionName();
if(action == 'sysverb_insert' ) // enter correct action name here
{ 
if(!confirm("Are you sure you want to submit the form?")){
		return false;
}

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP