- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 07:03 PM
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?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 09:11 PM - edited 01-09-2024 09:14 PM
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
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 07:30 PM - edited 01-09-2024 07:31 PM
@Al-jhon : Could you try with the below code and make sure that the action name on the UI action is 'canceldemand'.
function cancel() {
var ans = confirm('Are you sure to cancel the Demand?');
if (ans == true) {
// g_form.setValue('state', 4);
gsftSubmit(null, g_form.getFormElement(), 'canceldemand');
} else {
return false;
}
}
if (typeof window == 'undefined') {
current.active = false;
current.update(); // This commits to DB
var workflow = new global.Workflow();
workflow.cancel(current);
action.setRedirectURL(current);
gs.addInfoMessage('Demand has been cancelled');
}
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 09:13 PM
Hello @Sainath N , this can cancel the demand but still active is still true.
is it not possible to update active field via script? i will try to create BR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 09:16 PM - edited 01-09-2024 09:16 PM
@Al-jhon : Can you share the screenshot of the UI Action you configured? Also is this log statement printing during click of button?
gs.addInfoMessage('Demand has been cancelled');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 09:31 PM