Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action with List menu Context

122932
Tera Expert

Hi,

I'm creating a UI Action (List menu Context), to record the comments, then I have to do a GlideRecod to change the status and record the comment in the problem table, but when I run the Action it gives this error:

 

Unable to find UI Action with name 'rprovaprb' on table 'problem'

 

I'll send the screenshot:

JcSantos_0-1689852340755.png

function ree_repproval(){
if (confirm('teste ?')){

var reprovacao = prompt("teste ?");
g_form.setReadOnly('u_teste ', false);
g_form.setVisible('u_teste ', true);
g_form.setValue('u_teste ', reprovacao);
g_form.setValue('description', ' Justificativa técncia reprovação 2: ' + reprovacao + '\n\n' + g_form.getValue('description'));

if (g_form.getValue('u_teste ') == '') {
g_form.setReadOnly('u_teste ', false);
g_form.setVisible('u_teste ', true);
g_form.setMandatory('u_teste ', true);
g_form.addErrorMessage('Preencha explicação Técnica da reprovação do pedido.');
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'rprovaprb');
}
}

Can you help me? I need so much!

2 REPLIES 2

Voona Rohila
Mega Patron
Mega Patron

Hi @122932 

Please share the code instead of screenshot.

sample code for Using client and server code in a UI action.

// Client-side onclick function
function onClick() {
//client side code

  // Call the UI action and skip the 'onclick' function
  gsftSubmit(null, g_form.getFormElement(), 'action name'); //MUST call the 'Action name' set in this UI Action
}

// Code that runs without 'onclick'
// Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
  methodName();

// Server-side function
function methodName() {
  //server side logic
}

Using client and server code in a UI action

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Hi, 

Sorry, follow the code:

function ree_repproval(){
if (confirm('teste ?')){

var reprovacao = prompt("teste ?");
g_form.setReadOnly('u_teste ', false);
g_form.setVisible('u_teste ', true);
g_form.setValue('u_teste ', reprovacao);
g_form.setValue('description', ' Justificativa técncia reprovação 2: ' + reprovacao + '\n\n' + g_form.getValue('description'));

if (g_form.getValue('u_teste ') == '') {
g_form.setReadOnly('u_teste ', false);
g_form.setVisible('u_teste ', true);
g_form.setMandatory('u_teste ', true);
g_form.addErrorMessage('Preencha explicação Técnica da reprovação do pedido.');
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'rprovaprb');
}
}