How to display a confirmation Pop up in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2022 04:25 AM
Hi Team,
We have a catalog item and user will be filling the details in the catalog item form in service portal. While user is submitting the request it should display the message stating "Are you sure to submit the request: requested for" and it should contain ok and cancel button. If user is selecting ok it should submit the request. If user is selecting cancel then it should be in the same page. Kindly help me to achieve this,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2022 06:26 AM
Hi there,
You could create an onSubmit catalog client script as below:
function onSubmit() {
//Type appropriate comment here, and begin script below
if (g_scratchpad.isFormValid) {
return true;
}
var popup = confirm('Are you sure to submit the request?');
if (!popup) {
g_scratchpad.isFormValid = false;
return false;
} else {
g_scratchpad.isFormValid = true;
g_form.submit(g_form.getActionName());
return false;
}
}
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2022 03:15 AM
Hi chris,
It is working as expected but i want to display the requested for value also in the pop up. Could you please help me on this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2022 06:41 AM
Do you have a variable to store the Requested for value on your catalog items? I'm not sure what the exact name of it might be, but the below code should work (update requested for variable name if need be):
function onSubmit() {
//Type appropriate comment here, and begin script below
if (g_scratchpad.isFormValid) {
return true;
}
var popup = confirm('Are you sure to submit the request ' + g_form.getDisplayBox('requested_for') + '?');
if (!popup) {
g_scratchpad.isFormValid = false;
return false;
} else {
g_scratchpad.isFormValid = true;
g_form.submit(g_form.getActionName());
return false;
}
}
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2022 10:32 AM
Hi,
It is not working as expected.