Close spModal after 10 seconds
						
					
					
				
			
		
	
			
	
	
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2020 06:07 AM
I am looking for a piece of code to delay the closure of the spModal box. Currently as soon as you click "OK" the box closes however, instead of this I am hoping there is a piece of code I can use on the client script that will delay the closure of this box once the OK button is clicked by 5 seconds. This is for the portal. I currently have the following code and I would like the box closing after the it has been updated on the server if that makes sense as there is a slight delay in the background therefore, I wanted to box closing once the background work has been done. So I would need to add some code after the server update I think.
function(spModal) {
 /* widget controller */
 var c = this;
 c.amendAuthorisedManager = function(value){
 var warn = '<i class="fa fa-warning" aria-hidden="true"></i>';
 if (value == true){
 spModal.open({
 size: 'sm',
 title: 'Add as Authorised Manager',
 message: warn + ' This will enable the user to request access to company owned data and systems on behalf of other users.<p>Are you sure you want to make the user an Authorised Manager?</p>'
 }).then(function(confirmed) {
 console.log('widget dismissed');
 c.data.amendAuthorisedManager = 'Add';
 c.server.update();
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2020 06:26 AM
You can add delay like this inside then function
setTimeout(function(){ 
  c.data.amendAuthorisedManager = 'Add';
  c.server.update();
}, 5000);Mark the comment as a correct answer and helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2020 06:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2020 06:54 AM
I just want the OK box delaying as soon as you click ok
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2020 07:01 AM
I hope you closed the braces correctly for then function as i see it missing.
I think the box closes immediately bcoz thats a default function for which we will not have control. Anything to happen after you click okay can be delayed using that function.
