Alert option on Client Controller Portal widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2023 06:20 AM - edited ‎01-18-2023 06:27 AM
Hello All,
I currently have an alert message that opens up for confirmation of deactivating a User.
However it shows up the message with instance URL as shown below
However I do not want to popup the message that way with the URL. And here is my script below. Can someone please help to achieve this from a different pov.
Client
c.deactivateUser=function(name)
{
//alert("User will be deactivated");
if(confirm("Are you sure you want to deactivate the user?") == true){
c.data.username = name;
c.server.update().then(function(){
c.data.action='proceed';
});
} else {
alert("User was not deactivated.");
}
}
Also I need cancel option which is not available currently
HTML
<li><a href="javascript:void(0);" ng-click="c.deactivateUser(user.sys_id)">Deactivate User</a></li>
TIA/.
@Ankur Bawiskar @jaheerhattiwale @Community Alums @RaghavSh @Mark Roethof
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2023 06:30 AM
Hi @DPrasna,
Try with this updated client controller scripts -
c.deactivateUser = function(name) {
//alert("User will be deactivated");
c.data.username = name;
c.server.update().then(function() {
c.data.action = 'proceed';
});
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2023 07:05 AM
@DPrasna You can use spModal.open().
please check below link:
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2023 07:41 PM
as mentioned by other member you can use spModal.open()
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2023 10:05 PM
c.deactivateUser=function(name) { //alert("User will be deactivated"); if(confirm("Are you sure you want to deactivate the user?") == true){ c.data.username = name; c.server.update().then(function(){ c.data.action='proceed'; }); } else { alert("User was not deactivated."); } }
how to use spmodel in the above case? with ok and cancel options