- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 04:06 PM
Hi All,
I am currently scoping order guides and the functionality.
One thing I am noting on Step 2 of the guide there is a previous button.
If that button is selected then it will go back to the previous screen but the data on step 2 will be lost.
I want to put a confirmation message for the end users when previous is selected display popup
"All your current information will be lost, Do you wish to continue?"
I have found the following in the order guide widget but my lack of coding knowledge is not helping. How can I add a confirmation popup that if ok is selected it proceeds, if cancel is selected it stays on the current screen
HTML -
<div class="pull-right">
<button ng-hide="guide_step != 1 || submitted" name="submit" ng-click="goPrev()" class="btn btn-default padder pull-left-xs" ng-class="{'m-r-6': guide_step < 2}">{{::m.prevMsg}}</button>
Server script -
m.prevMsg = gs.getMessage("Previous");
Client controller -
$scope.goPrev = function() {
$scope.includedItems.forEach(function (item) {
item.isOpen = false;
})
$scope.guide_step--;
if($scope.guide_step==0)
spSCNavStateManager.unregisterForms(Object.keys(includedGformInstances));
}
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 04:31 PM
You could use spModal.confirm() inside of the #scope.goPrev function block. See docs below it has helped me in the past it's pretty handy
https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=SPM-confirm_S

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 04:31 PM
You could use spModal.confirm() inside of the #scope.goPrev function block. See docs below it has helped me in the past it's pretty handy
https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=SPM-confirm_S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 04:31 PM
You'd also have to clone the widget if you planned on doing it that way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2019 04:36 PM
Hi John,
Turns out I was just over complicating it. Your reference material really helped.
This is what I ended up with -
Modified "previous" button html
ng-click="c.onConfirm()"
Added the below to the Client controller script
c.onConfirm = function() {
spModal.confirm("Going back to the previous screen means you will lose any information you have entered in this step. Are you sure you want to go back?").then(function(confirmed) {
$scope.goPrev();
})
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2019 09:06 AM
Glad you got it working!