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.

When using "Update All" what is the view the system selects?

smaxwell
Kilo Contributor

I am trying to determine how the system select the view to use when performing an update all or update selected from a list. The view varies from table to table so I presume this can be configured somehow.

Anyone have any ideas?

1 ACCEPTED SOLUTION

/**


* Script executed on the Client for this menu action


*


* The following variables are available to the script:


*       'g_list' the GlideList2 that the script is running against (only valid for List context menus)


*       'g_fieldName' the name of the field that the context menu is running against (only valid for List context menus)


*       'g_sysId' the sys_id of the row or form that the script is running against


*       'rowSysId' is also set to the sys_id of the row to support legacy actions, but g_sysId is preferred


*/


runContextAction();




function runContextAction() {


    var url = new GlideURL(g_list.tableName + '_update.do');


    url.addParam('sys_action', 'sysverb_multiple_update');


    url.addParam('sysparm_multiple', 'true');


    url.addParam('sysparm_nostack', 'yes');


    url.addParam('sysparm_query', g_list.getQuery({fixed: true}));


    url.addParam('sysparm_view', g_list.getView());


   


    var msg = ['Update the entire list?', 'records'];


    var answer = new GwtMessage().getMessages(msg);


   


    if (!confirm(answer['Update the entire list?'] + " (" + g_list.grandTotalRows + " " + answer['records'] + ")"))


          return;


   


    window.location = url.getURL();


}


View solution in original post

5 REPLIES 5

Michael Fry1
Kilo Patron

On a module you can define a view (ess, or leave blank for default). There is a view field you can populate. The list view will show in that view.


Thanks Michael... but what I am trying to figure out is how the view is selected when I am working on a list and then choose Update All. At this point it opens a form for you to enter updates to. It is not consistent between different tables so there must be a way to set what view I wish to use for Update All / Update Selected.


Mike Allen
Mega Sage

It is a UI Context Menu: https://dev14066.service-now.com/nav_to.do?uri=sys_ui_context_menu.do?sys_id=f55ce0730a0a0b3e00a890c...



Looks like you can specify a view?   Looks like it inherits the view of the list.   For example:



Mobile view:


find_real_file.png



find_real_file.png


Self Service view:


find_real_file.png





find_real_file.png



Default view:


find_real_file.png


find_real_file.png


/**


* Script executed on the Client for this menu action


*


* The following variables are available to the script:


*       'g_list' the GlideList2 that the script is running against (only valid for List context menus)


*       'g_fieldName' the name of the field that the context menu is running against (only valid for List context menus)


*       'g_sysId' the sys_id of the row or form that the script is running against


*       'rowSysId' is also set to the sys_id of the row to support legacy actions, but g_sysId is preferred


*/


runContextAction();




function runContextAction() {


    var url = new GlideURL(g_list.tableName + '_update.do');


    url.addParam('sys_action', 'sysverb_multiple_update');


    url.addParam('sysparm_multiple', 'true');


    url.addParam('sysparm_nostack', 'yes');


    url.addParam('sysparm_query', g_list.getQuery({fixed: true}));


    url.addParam('sysparm_view', g_list.getView());


   


    var msg = ['Update the entire list?', 'records'];


    var answer = new GwtMessage().getMessages(msg);


   


    if (!confirm(answer['Update the entire list?'] + " (" + g_list.grandTotalRows + " " + answer['records'] + ")"))


          return;


   


    window.location = url.getURL();


}