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.

List choice UI action client script is not working

Nisha15
Mega Sage
Mega Sage

Instead of using gsftSubmit(null, g_form.getFormElement(), 'action_name'); I am using g_list.action('[sys_id of the UI action]', 'action_name'); but it is not working for me any suggestion, how I can do?

 

Nisha15_2-1713461643104.png

after line 18 I am calling server script, if button is server side it is working fine, but when i am adding client code it is not executing, can anyone help?
Thanks in advance,
Nisha

 

3 REPLIES 3

Allen Andreas
Tera Patron

Hi,

Have you referred to documentation such as this to help you achieve this?

https://docs.servicenow.com/bundle/washingtondc-api-reference/page/script/useful-scripts/reference/u... 


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen,

gsftSubmit(null, g_form.getFormElement(), 'resolve_incident');

This doc is refering to use gsftsubmit which does not work for list v2 right?

Nisha15
Mega Sage
Mega Sage

 

function onClickcopyList() {
    var gm = new GlideModal("glide_confirm_standard", true, 600);
    gm.setTitle("Copy this record?");
    gm.setPreference("title", "Copy this record?");
    gm.setPreference("warning", "false");
    gm.setPreference("onPromptComplete", function() {
        // This function should execute after confirmation
        var tablename = "name of the table";
        var the_list = GlideList2.get(tablename);
        var selected = the_list.getChecked();
        // Ensure action and action name are valid
        the_list.action('sys id of the ui action', 'ui action name, selected);
    });
    gm.setPreference("onPromptCancel", function() {
        // This function should execute if canceled
        return false;
    });
    gm.render(); 
}
am i missing something? after this line server code is getting executed.