List context menu client server.

tee15
Giga Contributor

Hi,
I need create a code UI Action for client Script using "List context menu", but don't work.
When I use:
g_list.action('[sys_id of the reopen_incident UI action]', 'reopen_incident');
got error :'No records selected'.
When I use:
gsftSubmit(null, g_form.getFormElement(), 'reprova_problem');
Got Error: 'Error MessageUnable to find UI Action with name 'reprova_problem' on table 'problem''.
This is my code:

 

function runClientCode(){
 
//gsftSubmit(null, g_form.getFormElement(), 'reprova_problem');
var userConfirmed = false;
 
try {
//try to get the items the user checked,
//if the object is undefined that means we are on the form
//var checkedItems = g_list.getChecked();
 
userConfirmed = confirm('Are you sure you want to retire ');
 
if (userConfirmed) {
 
g_list.action('250284310f210300ed9e7cca4200002e', 'reprova_problem');    
 
} else {
 
return false;
 
}
 
} catch (e) {
 
//if we got here, that means we're on the form 
 
userConfirmed = confirm('Are you sure you want to retire this asset?');
 
if (userConfirmed) {
 
gsftSubmit(null, g_form.getFormElement(), 'reprova_problem');
 
} else {
 
return false;
 
}
}
}
 
 
 
if(typeof window == 'undefined')
runServerCode();
 
function runServerCode(){
current.state = 'rejected';
current.update();
action.setRedirectURL(current);
}
 

 

Please, can you help-me?
Thanks!

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, coincidently this exact question was also posted by another community user.

Error List context menu side server client - ServiceNow Community
There is no need to post the same question multiple times in the community forums, or to use multiple user accounts to paste the same question. This does not benefit you or the wider community.