Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
function fieldsOnDelete(){ return "MEFIELDNAME"; }
function onDelete(field1){
	if( field1 == 'field value'){
		window.location = "MELT://showAlert/Message to display"; return false;
	}else{
		return true;
	}
} 


An example of a complete onDelete query with header and footer information, which checks a single condition, is as follows:

Code Block
<html><head><title>OnDeleteExample1</title>
<script type="text/javascript"> 
function fieldsOnDelete(){ return "CUSTKW02"; }
function onDelete(status){
	if( status == 'Open'){
		window.location = "MELT://showAlert/You cannot delete open Activities"; return false;
	}else{
		return true;
	}
}
</script></head><body></Body><body></html> 


where:
function fieldsOnDelete(){ return "MEFIELDNAME";} defines which field to read. To read the value stored in the CUSTKW02 field, the following is defined in onDelete example 1:

...


{window.location = "MELT://showAlert:/Message to display"; return false;} defines what happens if the previous condition is met using the code. According to the code, a message will be displayed and a False value will be returned preventing the record from being deleted. To define which message to display, the code in onDelete example 1 is as follows:

...

Code Block
else{ return true; }