Posts

Showing posts with the label Platform

Count Number of Days

SI Function:  daysToDueDate: function(incident) {          var totalDuration;           var now = new GlideDateTime().getLocalDate();       if (!incident.dueDate.nil()) {               var dueDate = new GlideDateTime(incident.duedate).getDate();               totalDuration = new GlideDateTime.subtract(now, dueDate);               var numberofDays = parseInt(totalDuration.getNumericValue() / 86400000);               }     return nubmerOfDays; },                                             

How to Get a list field values as comma seperated

SI Function:   inAListFied: function(incident) {     var userID = gs.getUserID();     var watchList = incident.getValue('watchlist');     if (watchList) {          var arrIncident = watchList.split(",");          var ListValues = (arrIncident.indexOf(userID) >= 0);       }     return ListValues; },

SNow - Clean Architecture

Clean Architecture with ServiceNow Introduction The following set of rules is aimed to provide a maintainable, extendable and understandable architecture for any solution within service now. They are kept as short as possible to allow for a one page document. Please share your thoughts and feedback, as well as your critique. 1 Script Includes are for Data Manipulation Don’t save. Don’t update. Don’t insert. Don’t delete. In fact: Script Includes don’t. They provide. 2 Business Rules are for Data Transformation Do save. Do update. Do insert. Do delete. In fact: Business Rules do, but won’t think. Therefore, make Script Includes the brain of Business Rules. 3 Client scripts are for displaying data What do they display? Data! Where do they get it from? Queries! Do they think? No! Do they do? No! But what are they there for? To display data. That’s it. 4 Workflows are a succession of Business Rules Follow the same principles! They do, but won’t think. Make Sc...

Application Server Performance Checks

Response Times Remove unused inactivity Monitors Optimize queries to search Adjust auto-complete wait time in increments of 50ms, no more than 750 Check SLA trace level -Monitor process duration of scheduled jobs Default Row Count Go To Search Option Auto-complete Search Option Table Rotation

Can you update a record without updating its system fields(like sys_updated_by, sys_updated_on)?

Yes, you can do it by using a function autoSysFields() in your server side scripting. Whenever you are updating a record set the autoSysFields() to false example: var gr = new GlideRecord('incident'); gr.query(); if(gr.next()) { gr.autoSysFields(false); gr.short_description = "ServiceNow" ; gr.update(); }