1 – Never name a GlideRecord object by gr. Instead, you can be more specific on the name that you are choosing. For instance, you can let Gr in the beginning then add the name of the table, as shown below.
var queryString = "priority=1^ORpriority=2";
var gr_inc = new GlideRecord('incident');
gr_inc .addEncodedQuery(queryString);
gr_inc .query();
while (gr_inc .next()) {
gs.addInfoMessage(gr_inc.number);
}
2 – Never use console.log() on the client script or UI policies. Instead, you can make a call to jslog().
function logData (r ) {
lastLogDate = r. responseXML. documentElement. getAttribute ( "last_log_entry" ) ; var items = r. responseXML. getElementsByTagName ( "log" ) ;
jslog ( "response=" + r. responseText ) ; }
3 – You should always replace all non-internationalised strings in the HTML template with translatable strings using ${Message here} syntax or gs.getMessage(Message here) on a data.var on the server. This allows for better localization support across the portal.
Recent Comments