We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Confirmation message on button on order guide

Nicole_k
Kilo Expert

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));
}

 

1 ACCEPTED SOLUTION

Not applicable

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

View solution in original post

7 REPLIES 7

Nicole_k
Kilo Expert

Thanks for the reply John, As soon as I use the spModel function in the order guide it breaks the order guide.

Ignore that. i found that the function was already being called above. Still no luck though. i will keep trying.

Not applicable

Hi Nicole,

 

Can you share the code with me that you have so far?

 

Thanks,

John