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-24-2022 02:08 PM
Hi Arun,
Please try below onSubmit catalog client script instead, it should work:
function onSubmit() {
g_form.getReference('requested_for', doPopup);
}
function doPopup(reqFor) {
if (g_scratchpad.isFormValid) {
return true;
}
var popup = confirm('Are you sure to submit the request ' + reqFor.getValue('name') + '?');
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-25-2022 03:06 AM
Hi Chris,
We are getting pop up and also it is displaying the requested for in the popup also. But when we are clicking on the cancel button it is also submitting the request. It should not allow to submit the request if we are clicking on cancel button. It should allow to submit the request if we are clicking on OK button

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 06:02 AM
Ok that is good it is getting closer. Let's try simplifying the script a little bit -- can you try the below?
Also, I would really appreciate it if you would mark my answers as helpful and/or correct!
function onSubmit() {
g_form.getReference('requested_for', doPopup);
}
function doPopup(reqFor) {
var popup = confirm('Are you sure to submit the request ' + reqFor.getValue('name') + '?');
if (!popup) {
return false;
} else {
return true;
}
}
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-25-2022 11:07 AM
Hi Chris,
I have tried but still it is allowing me to submit the ticket.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 11:26 AM
Ok please update script as below and reply with results:
function onSubmit() {
g_form.getReference('requested_for', doPopup);
}
function doPopup(reqFor) {
var popup = confirm('Are you sure to submit the request ' + reqFor.getValue('name') + '?');
alert('popup val is: ' + popup);
if (!popup) {
return false;
} else {
return false;
}
}
Also, I would really appreciate it if you would mark my answers as helpful and/or correct!
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry