- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2023 10:13 PM
Hi All,
I am trying to user SP Modal Confirm for a message. Client controller as shown below
c.deactivateUser=function(name)
{
spModal.confirm("Are you sure you want to deactivate the user? ").then(function(confirmed) {
if (confirmed) {
c.data.username = name;
c.server.update().then(function(){
c.data.action='proceed';
c.getUserlist();
});
}
else
{
spModal.alert("User was not deactivated.");
}
});
}
I would want to exclude the "close Modal" functionality. How to do the same? or atleast I do not want the message to show up.
Please help.
Thanks
@Community Alums @Basheer @Ankur Bawiskar @Brad Bowman @Shubham_Shinde
Solved! Go to Solution.
- Labels:
-
ITSM: General
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 04:44 AM
Hello @babarat1
If you're trying to pass the data.action to server side script you can do it by using c.server.get({action:"proceed"}), and can access this in server side script by using input.action.
For ex:
/*Client Controller*/
c.server.get({action:"proceed"}).then(function(response){
c.getUserlist(); //Assuming this function is present in your client controller
})
/*Server Side*/
if(input.action){
//Any code to process
}
P.S. If you're trying to call a function of server script then you can use the above code and call the desired function inside the if block in server side script.
If my answer has helped with your question, please mark it as helpful and give it a thumbs up!
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 05:36 AM
Hello @babarat1 ,
Please refer the solution mentioned in the below post it might solve your problem:
https://www.servicenow.com/community/developer-forum/need-to-remove-close-x-button-from-spmodal/m-p/...
Mark this comment as correct/helpful if it helps you!
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 03:55 AM
Thanks for the reply shubham. I tried however it is not calling the server side action when I add the solution as below
c.deactivateUser=function(name)
{
spModal.confirm("Are you sure you want to deactivate the user? This action will remove all roles from the user and remove the user from this list.").then(function(confirmed) {
if (confirmed) {
c.data.username = name;
c.server.update().then(function(){
c.data.action='proceed';
c.getUserlist();
});
}
else
{
spModal.alert("User was not deactivated.");
}
});
setTimeout(function() {
var closeButton = this.document.getElementsByClassName('close pull-right');
//console.log(closeButton.length);
for (var i = 0; i < closeButton.length; i++) {
closeButton[i].style.display = 'none';
}
}, 0);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 04:44 AM
Hello @babarat1
If you're trying to pass the data.action to server side script you can do it by using c.server.get({action:"proceed"}), and can access this in server side script by using input.action.
For ex:
/*Client Controller*/
c.server.get({action:"proceed"}).then(function(response){
c.getUserlist(); //Assuming this function is present in your client controller
})
/*Server Side*/
if(input.action){
//Any code to process
}
P.S. If you're trying to call a function of server script then you can use the above code and call the desired function inside the if block in server side script.
If my answer has helped with your question, please mark it as helpful and give it a thumbs up!
Regards,
Shubham