ck_phenix
Kilo Expert

Here are some knowledge sharing info that can be followed when one is involved in ServiceNow development or any maintenance activity. The write up has 3 portions covering different topics as below:

Did you know?


Task table flattening is a concept of linking Task table with its child tables like Incident, Problem, and Change etc. as a single flat table at the database level. This is available OOB for MySQL databases starting from Dublin release. Oracle database requires ServiceNow technical support.


What it means? Task table along with its child tables are now stored as single table in database without affecting the appearance or functionality in ServiceNow instance. This improves the query performance time over joined tables as compared to previous versions of ServiceNow. For example, querying both Incident and Problem table values would result in substantial improvement in response time.


What you need to verify before upgrading to Dublin? Custom applications extended from Task table needs to be limited, as the maximum size for a single row of a table in database (MySQL) is 65,535 bytes. For example, utf8 characters requires 3 bytes per character, so for a 255 character set column, 255 * 3 = 765 bytes per value. A table cannot hold 65,535 / 765 = 85 such columns.


ServiceNow Tips for Server-side Scripting


Below are some useful tips while working on Business Rules, Workflows, Script Includes or any other server-side scripting:

  • Use indexed fields in your GlideRecord queries for faster response.
  • Go to Content pane of a table and filter the records of your need. Right click on the filtered query and click on Copy query. Use this in your addEncodedQuery() method of GlideRecord for easy scripting.
  • setLimit(<number>) method of GlideRecord allows you to query only the number of records.
  • setWorkflow(false) method of GlideRecord helps you to turn off the Workflows, Business rules etc (in general all your server side scripts)
  • Check the response time of your script by running it in Scripts-background module in your instance. Top of the Output screen shows the response in milliseconds.


Best Practices in Import Sets Transformation


We recall some of the Best practices followed in ServiceNow Import Sets Transformation. Examples of applicability include LDAP integration, CMDB CI data import or any other integration with ServiceNow.

  • Choose indexed field for coalesce or index the coalesce field in the Transform map for faster performance of Import Set transformation.
  • Set the Date time format <yyyy-mm-dd HH:mm:ss> to preserve the 24 hour clock ServiceNow settings for mapping date time fields.
  • It's always better to fill the Referenced value field name for reference field lookup mappings if the source data is other than display value of the table in Transform map.
  • Choice action column in Transform map is always "create" by default. Make sure to change this to ignore or reject accordingly for reference and choice list fields to avoid invalid values in the referenced or choice list table.
  • Use Transform map variables like log, action, answer, error, ignore in relevant for your scripting for easy debugging.

For any queries, contact us via servicenow@blusurge.com or info@blusurge.com