Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2023 12:56 PM
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);