The CreatorCon Call for Content is officially open! Get started here.

Cancel Button in Demand

Al-jhon
Kilo Sage

I created a UI Action to cancel a demand with script below:

But active field is not changing to FALSE.

is there issue with my script? Or i can try BR to update the active field to false?


function cancel() {
    var ans = confirm('Are you sure to cancel the Demand?');
    if (ans == true) {
 
    g_form.setValue('state', 4);
 
    } else {
 
        return false;
    }
    gsftSubmit(null, g_form.getFormElement(), 'canceldemand');
}
 
serverside();
 
function serverside() {
 
current.active = false;
current.update();
 
var workflow = new global.Workflow();
workflow.cancel(current);
 
 
    action.setRedirectURL(current);
    gs.addInfoMessage('Demand has been cancelled');
}
 
 
 
1 ACCEPTED SOLUTION

Hi @Al-jhon You dont need to create a new state to cater this requirement

, you can use OOB rejected option to cancel the Demand. use 7 as value . When demand is rejected, active will be set to false dynamically through OOB script

 

Please chek this OOB business rule to see how demand state works

Demand Active State Management

HarishKM_0-1704863484127.png

 

Regards
Harish

View solution in original post

8 REPLIES 8

Harish KM
Kilo Patron
Kilo Patron

Hi @Al-jhon OOB there is no state values as '4' for demand. Can you check the state value?is it custom state?

Regards
Harish

Helo Harish, i created the new state "cancelled" = 4 under demand table.

Hi @Al-jhon You dont need to create a new state to cater this requirement

, you can use OOB rejected option to cancel the Demand. use 7 as value . When demand is rejected, active will be set to false dynamically through OOB script

 

Please chek this OOB business rule to see how demand state works

Demand Active State Management

HarishKM_0-1704863484127.png

 

Regards
Harish

That is my last option. thanks