Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Show confirm modal on load of the widget

Tapish Sharma1
Kilo Sage

Hi folks, 

I am trying to show a confirm modal before displaying the table lost widget. From the header menu when the user clicks on the menu option...the list view appears, but before that I want to show a confirm box and ask the user to accept terms to view the information. I am able to show the confirm box ,but I need to show the confirm modal ! 

Is there a say we can call the modal function onload of the widget? How can I call this client script function on load of the widget

 

client script function - 

c.onConfirm = function() {
c.confirmed = "asking";
spModal.confirm("Can you confirm or deny this?").then(function(confirmed) {
c.confirmed = confirmed; // true or false
})
}

2 REPLIES 2

Peter Bodelier
Giga Sage

Hi @Tapish Sharma1 

 

Unchecked but I think it is as easy as calling the function in your client script:

 

c.confirm();

c.onConfirm = function() {
c.confirmed = "asking";
spModal.confirm("Can you confirm or deny this?").then(function(confirmed) {
c.confirmed = confirmed; // true or false
})
}

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi Peter , Thanks for your response , i wanted to call this client function onload of widget in html , I was able to achieve that using the ng-init directive