Alert option on Client Controller Portal widget

DPrasna
Tera Contributor

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

DPrasna_0-1674051463887.png

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&colon;void(0);" ng-click="c.deactivateUser(user.sys_id)">Deactivate User</a></li>

 

 

TIA/.

@Ankur Bawiskar @jaheerhattiwale @Community Alums @Raghav Sharma24 @Mark Roethof 

6 REPLIES 6

@DPrasna Check the below youtube video

 

https://youtu.be/ADmDpbX94Mk

 

Please mark as correct answer if this solves your issue.

RishabhSingh054
Tera Contributor

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...

Please refer to this link.

you can use spModel if you pass it in your client function.

spModal.alert('How do you feel today?').then(function (answer) {
            c.simple = answer;
        });