Dom Gattuso
Mega Sage

On the the UI Action:

Action name: cancel_request

Client: true

Onclick: confirmCancel()

 Ui action script: 

function confirmCancel(){
	if(confirm('Are you sure you want to Cancel?')){
		var reason = prompt("Why do you want to cancel?");
		if(reason){
			//If you wish to capture the reason on the record
			g_form.setValue('<field>',reason);
		}
		gsftSubmit(null,g_form.getFormElement(), 'cancel_request'); //UI Action > Action name
	}else{
		return false;
	}
}


if(typeof window == 'undefined'){
	cancelRequest();
}

/**
* Cancels the record and reloads the page
*/
function cancelRequest(){
	action.setRedirectURL(current);