- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 11:33 AM
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?
Solved! Go to Solution.
- Labels:
-
Demand Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 12:06 PM
Hi Gurbir,
You can create a UI action from System UI >> UI Action named Cancel on Demand (dmn_demand) as below.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 11:47 AM
We are trying to avoid Delete button.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 11:40 AM
Hi Gurbir,
This link will help you.
Thanks
Naveen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 12:06 PM
Hi Gurbir,
You can create a UI action from System UI >> UI Action named Cancel on Demand (dmn_demand) as below.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 01:05 PM
Hello Jaspal,
I added a process flow and state called Canceled (state value 12)
after i hit "cancel" i see the state changing from "Draft" to "Canceled" but when i go back to demand to double check, its reverted back to Draft.
function callme() {
var ans = confirm('Are you sure you want to cancel the Demand?');
if (ans == true) {
g_form.setValue('state', '12');
} else {
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'confirmcancellation');
}
serverside();
function serverside() {
current.update();
action.setRedirectURL(current);
gs.addInfoMessage('Demand has been cancelled');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 12:55 AM
Add
current.state='12'; just before current.update(); & it should work