JavaScript Executor Question

jmuomini
Mega Expert

Hi,

I'm trying to run the script below using the JavaScript Executor (Ctrl-Alt-Shift-J). Nothing happens when I click "Run my code." Is something wrong with the code, or is this not the right place to run it?

Thanks, JiM


<script>
//Generic Incident update script. Update query and update lines
var gr = new GlideRecord('incident');
gr.addQuery('u_source','Walk-in');   //Change query to field being updated
//gr.addQuery('u_subcategory','USFwebsite');
//gr.addQuery('field','value');
gr.query();
while (gr.next()) {
     gr.u_category = 'LMN Walk-in';     //Change to field being updated
     gr.setWorkflow(false);
     gr.autoSysFields(false);
     gr.update();
}
</script>
7 REPLIES 7

Thank You


Hi Mark,



I am trying to use the ctrl+shift+alt+j in list edit to check the number of records selected in list edit. However it is not working, can you pls help me on this, where it went wrong, I am trying to use the code in the UI action.



var getChecked = g_list.getChecked();


  var sys_id = getChecked.split(",");


  var countChecked = sys_id.length;


  alert(countChecked);



Thanks!!


The SN Nerd
Giga Sage
Giga Sage

Use Xplore to test code


ServiceNow Share



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022