- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 07:32 AM
Hi guys,
I was wondering if I could open a modal popup with some data in it after a record producer is submitted in Service Portal. I have this record producer that requires displaying some information to the users upon submitting a form and wonder if someone could shed some light on how to achieve this please?
Many thanks,
JD
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 11:19 AM
here is an example onload client script I wrote that should work for either SP or OOB views. you can render direct content in the glidemodal like this code below. If you would rather use a ui page that is fine for the GM, but for the spModal, you would need to create a new SP widget to display it. this should give you the concept though. spModal is only available on Portal, so that is why we handle both cases in one script. Make sure you select UI Type = All in your client script.
function onLoad() {
//Type appropriate comment here, and begin script below
if (typeof spModal != 'undefined') {
spModal.open({
message: 'This is a test SP modal',
title: 'Test SP Modal'
});
} else {
var gm = new GlideModal();
gm.setTitle('Test GM');
gm.renderWithContent('This is a test GlideModal');
}
}
This technically should work the same in a catalog onSubmit client script, but I still feel there will be an issue with redirects in the OOB view, though it actually may work fine in the SP because it is a single page app so doesn't do a true redirect after submission.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 09:04 AM
Hi Jonathan,
I don't think the 'onsubmit' function is an issue. I was able to open the GlideModal from the onsubmit function. But, i definitely agree the option without UI page is better .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 09:09 AM
The issue isn't so much that the modal won't open, the issue is that the submission of the form isn't going to wait for your interactions in the modal.
your onsubmit function will fire, then your modal will show, but then your onsubmit function will finish and your form will be submitted and the page will redirect to your new record. So the modal will show for a split second maybe then redirect.
this is assuming you want to show the modal on a successful submission. If you want to show it on a failed submission it is fine, as long as you return false on the onsubmit function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 09:12 AM
I didn't see that happening, the onsubmit function did not go through until i exited the modal window.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 11:05 AM
interesting, I just tried it on my developer instance, and the modal showed briefly, but the form submission still continued and redirected to the next page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 08:54 AM
Hi John,
I tried with your code, and its working . Where do you see the error?