How can I refresh all the table when I change the state without enter to the record?

alejandrojimen1
Kilo Contributor

I would like to know how I can refresh all the table when I change the state. In the same table, without enter to the record.

I made a Business Rule to update all the states from this record state.

So when I change the state I have to refresh list to see it. I would like to ServiceNow do it automatically.

I suppose this is a work for an Client Script, type onCellEdit, Field name: state.

I tried but doesn't work:

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {

  var saveAndClose = true;

  //Type appropriate comment here, and begin script below

  GlideList2.get('current').refresh();

  callback(saveAndClose);

}

question.png

Thanks!!

3 REPLIES 3

srinivasthelu
Tera Guru

Hi Alejandro,



Please try this.



function onCellEdit(sysIDs, table, oldValues, newValue, callback) {


  var saveAndClose = true;


  callback(saveAndClose);  


  document.location.reload(true);


}  


Cheers


Srini


Hi Srini,



Doesn ´t work. Thanks for help.



I would like a function to refresh/reload all the table. I know is possible but I dont know how.



Thanks!


Hi Alejandro,



I can confirm that above code worked for me just fine.



Next steps: I would look at console for errors.


Are you writing this client script in a   scoped app?



Cheers


Srini