- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 02:16 AM
I have created 2 UI Action Buttons "Approve"& "Reject" in sc_req_item table:
How ever when I am checking the service portal only Approve button is visible and Reject button is not visible:
Reject button is configured as below screenshot and script and when I uncheck the "Client" option it is appearing but then it is not working as expected.
SCRIPT:
function testComments() {
if (g_form.getValue('u_work_notes_input') == "") {
g_form.addErrorMessage('Please provide your rejection comments in "Work Notes" field.');
return false;
} else {
// Bypass the check if the form has been modified
//g_form.modified = false;
g_form.setValue("u_custom_app_state", "rejected");
// gsftSubmit(document.getElementById('sysverb_update'));
g_form.save();
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 03:45 AM
Hello All,
I have figured it out.
I have created a "OnSubmit" client script as below:
and uncheck the "Client" option from my button and written a script:
current.u_custom_app_state='rejected';
action.setRedirectURL(current);
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 02:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 03:01 AM
Hello Saurav,
Thanks for reply,
There is no UI Action Visibility set and there is condition : gs.hasRole('admin').
As an Admin, I should be able to see it in Service Portal.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 02:35 AM
Hi Sahil,
You need to uncheck the Client checkbox for the button to show on portal. If there is any client side check you will have to convert it to a Before Insert/Update Business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 02:49 AM
Hello Jaspal,
Thanks for the reply, However I have created a Business rule:
Script:
(function executeRule(current, previous /*null when async*/) {
if(current.getActionName() == 'rejectbtest')
{
if (current.getValue('u_work_notes_input') == "") {
current.addErrorMessage('Please provide your rejection comments in "Work Notes" field.');
return false;
} else {
// Bypass the check if the form has been modified
current.u_custom_app_state.setValue('rejected');
//g_form.setValue("u_custom_app_state", "rejected");
g_form.save();
}
}
})(current, previous);
But now the button is not doing any thing even in ITIL view.