- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2019 09:53 PM
I have a requirement to open a dialog window after hitting the submit button in service portal.
When they hit continue, it redirect users and changes focus to an external site and passes request item number as part of the URL on submission. While the original catalog request status page is left in the original window.
In the CMS, I was able to accomplish this by modifying the 'sc_order_status_view_intro_text' UI macro.
I called GlideDialogWindow and passed in the request item number using dialog.setPreference.
The custom page then client script uses
var gdw = GlideDialogWindow.get();
var f = gdw.getPreference('onPromptComplete');
The function onPromptComplete is in my 'sc_order_status_view_intro_text' UI macro. and performed the redirect using window.open.
Has anyone performed this type of customization in the service portal?
I understand you will need to use Modal and customized 'SC Catalog Item Deprecated'???
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 01:36 AM
You Can use spModal to open another widget on click of submit button in portal , pass the widgetID as the ID of another widget to open , in buttons you can add custom names for your button . a sample code show below.
spModal.open({
title: 'Your Title',
widget: widgetId,
widgetInput: {'sys_id':binId},
buttons: [
{label:'✔ ${Continue}', cancel: true},
{label:'✔ ${Cancel}', primary: true},
]
}).then(function(){
console.log('widget dismissed');
});
Documentation: https://developer.servicenow.com/app.do#!/api_doc?v=london&id=SPModal-API
Example : https://snportal.co.uk/displaying-widgets-in-modals/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 01:36 AM
You Can use spModal to open another widget on click of submit button in portal , pass the widgetID as the ID of another widget to open , in buttons you can add custom names for your button . a sample code show below.
spModal.open({
title: 'Your Title',
widget: widgetId,
widgetInput: {'sys_id':binId},
buttons: [
{label:'✔ ${Continue}', cancel: true},
{label:'✔ ${Cancel}', primary: true},
]
}).then(function(){
console.log('widget dismissed');
});
Documentation: https://developer.servicenow.com/app.do#!/api_doc?v=london&id=SPModal-API
Example : https://snportal.co.uk/displaying-widgets-in-modals/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2019 01:17 PM
I am using the SC Catalog Item Deprecated widget.
Currently, i am redirecting users to cart like so.
function addToCart() {
postCatalogFormRequest().success(function(response) {
$rootScope.$broadcast("$sp.service_catalog.cart.add_item");
$rootScope.$broadcast("$sp.service_catalog.cart.update");
//spUtil.addInfoMessage("Added item to shopping cart");
$scope.submitting = false;
c.status = "Added item to shopping cart";
});
var url = "sp?id=sc_cart";
$window.location.href = url;
}
Can you provide an example, so both the redirection occurs and the widget opens?
I've seen references to spUtil.get, is there any reason to use spmodal.open instead of this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2019 06:53 AM
I ended up using an onsubmit client script and calling the spModal API.