UI Action Button is not coming in Service Portal

Sahil Raina
Mega Guru

I have created 2 UI Action Buttons "Approve"& "Reject"  in sc_req_item table:

find_real_file.png

How ever when I am checking the service portal only Approve button is visible and Reject button is not visible:

find_real_file.png

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.

find_real_file.png

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();
}
}

1 ACCEPTED SOLUTION

Sahil Raina
Mega Guru

Hello All,

I have figured it out.

I have created a "OnSubmit" client script as below:

find_real_file.png

and uncheck the "Client" option from my button and written a script:

current.u_custom_app_state='rejected';
action.setRedirectURL(current);
current.update();

 

View solution in original post

8 REPLIES 8

Saurav11
Kilo Patron
Kilo Patron

Hello,

Please check if there portal visibility is hidden from the User.

find_real_file.png

Also on reject button are there any conditions?

find_real_file.png

Please mark answer correct/helpful based on Impact.

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.

Jaspal Singh
Mega Patron
Mega Patron

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.

Hello Jaspal,

Thanks for the reply, However I have created a Business rule:

find_real_file.png

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.