Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Object - Pop up message when user clicks on Save or Save&Close

conorchaney
Contributor III

Hi all, 

I have the following requirement:

  • When a user clicks on Save or Save & Close, a pop-up asks them "Are you sure you want to submit...". 
    • If they select yes, then the record saves; or
    • If they select no, the pop-up closes and the record does not save. 

I'm weak on the javascript side but understand I need some javascript in a custom object on my layout. 

I have read many different threads on the custom object page but have found no answer. 

Thanks for your help.

 

Referencing a very similar question which I could not get a result from: https://community.rsa.com/t5/archer-custom-objects/create-popup-message-upon-save/m-p/467369

 

1 ACCEPTED SOLUTION

Accepted Solutions

Ilya_Khen
Champion III

 

 

 

<script>
	var 
		title = 'Confirmation is required',
		message = 'Please confirm';
	
	function saveApply(action) {
		var userConfirmed = function(arg){
			if(arg) { 
				if(action == 'save') {
					$('#master_btnSave').click();
				} else if(action == 'apply') {
					$('#master_btnApply').click();
				}
			}
		};  
		
		WarningConfirm(message, userConfirmed, title);		
	}
	
	Sys.Application.add_load(function() { 
		$('#master_btnSave1').unbind('click').prop("onclick", null).click(function(){ saveApply('save'); return false;});

		$('#master_btnApply1').unbind('click').prop("onclick", null).click(function(){ saveApply('apply'); return false;});
	});
</script>

 

 

 

View solution in original post

10 REPLIES 10

Ilya_Khen
Champion III

conorchaney
Contributor III

Hi IIya,

 

I have read through those articles and cannot seem to piece together the required code

 

@DavidPetty  Do you know of simple code to achieve this

Ilya_Khen
Champion III

 

 

 

<script>
	var 
		title = 'Confirmation is required',
		message = 'Please confirm';
	
	function saveApply(action) {
		var userConfirmed = function(arg){
			if(arg) { 
				if(action == 'save') {
					$('#master_btnSave').click();
				} else if(action == 'apply') {
					$('#master_btnApply').click();
				}
			}
		};  
		
		WarningConfirm(message, userConfirmed, title);		
	}
	
	Sys.Application.add_load(function() { 
		$('#master_btnSave1').unbind('click').prop("onclick", null).click(function(){ saveApply('save'); return false;});

		$('#master_btnApply1').unbind('click').prop("onclick", null).click(function(){ saveApply('apply'); return false;});
	});
</script>

 

 

 

conorchaney
Contributor III

@Ilya_Khen  fantastic, I have tested this and it works a charm! 

 

As always, I appreciate the effort you put into this! 

Ilya_Khen
Champion III

Anytime

@Ilya_Khen 

Small amendment and question.

Using your code from another forum to hide the save & save and close buttons, I now would like to update the above code so that the pop-up appears when the user clicks on the AWF button that starts the workflow: conorchaney_0-1629279545769.png

 

I used inspect element to get the name of the AWF button and added it to the code: see below. When I select "Submit for GIS REview" the message appears, when I select "Ok" in the pop-up, nothing happens. I assume I am missing a function to start the workflow but I cannot figure it out. Appreciate your support. 

<script>
  var title = 'Confirmation is required',
    message = 'Select OK if you would like to proceed with submission, changes canot be made once engagement is submitted';

function saveApply(action) {
  var userConfirmed = function(arg) {
    if (arg) {
      if (action == 'save') {
        $('#master_ondemand_16').click();
      } else if (action == 'apply') {
        $('#master_ondemand_16').click();
      }
    }
  };
  WarningConfirm(message, userConfirmed, title);
}
Sys.Application.add_load(function() {
  $('#master_ondemand_16').unbind('click').prop("onclick", null).click(function() {
    saveApply('save');
    return false;
  });
  $('#master_ondemand_16').unbind('click').prop("onclick", null).click(function() {
    saveApply('apply');
    return false;
  });
}); </script>

 

Ilya_Khen
Champion III

You are changing behavior of your AWF button everywhere, surely you will have no actions happened after click. You removed the click functionality and then referring to it back in the saveApply function. 

Hmm ok, So is it possible for a pop-up message to appear when the AWF "Submit" button is selected? I thought changing the button name in your code might do it but it doesn't seem to

Hi IIya,

Is there an updated version of this to work with AWF?  

 

Thank you so much!