Add cancel button in a Demand when in Draft State only

GB14
Kilo Patron

We need to add the "Cancel Demand" button to a demand form. 
Canceled state is not available oob so we created the state manually. 

We want a popup to confirm and then request canceled.

What would be UI action script to add the button?  

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi Gurbir,

 

You can create a UI action from System UI >> UI Action named Cancel on Demand (dmn_demand) as below.

find_real_file.png

 

function callme() {
    var ans = confirm('Are you sure you want to cancel the request?');
    if (ans == true) {
        g_form.setValue('state', '5'); //suppose 5 is state value for Cancel that you have created
    } else {
        return false;
    }
    gsftSubmit(null, g_form.getFormElement(), 'confirmcancellation');
}

serverside();

function serverside() {

    current.update();
    action.setRedirectURL(current);
    gs.addInfoMessage('Demand has been cancelled');
}

 

Kindly ensure you have additional state choice created & if so pass in the script accordingly. 

View solution in original post

12 REPLIES 12

find_real_file.png

 

 

find_real_file.png

 

The same thing happened again. It updates the state to Canceled when I click on cancel demand but when I go back to demand to double-check, it's reverted back to Draft. 

 

thank you for help 🙂

Can you check if there is an before/after update business rule that on Demand (dmn_demand) table once. 

found only this after update business rule:

 

find_real_file.png