Understanding and using inheritance in Script include

A few days ago I saw a question on the ServiceNow community about how inheritance works in a script include so I thought to write a short article about that.

In Script include we can write a function or we can create a class. In JavaScript, class is an object, an object can access properties and functions from another object, this we call Inheritance

Inheritance is a great way to create a parent/child hierarchy of classes. A good use case for inheritance is when you wish to indicate that one object is mostly similar to another, but with some variations.

Continue reading →

Naming Variables and Functions

We all come across situation where we have to look at a code that it’s written by someone else and try to figure out what is that variable does or what is this function suppose to do.

This is where good naming is important. it saves us time and significantly reduce error. I know naming variables and functions can be tricky. In this post, I share two characteristics that can be a foundation or starting point for good naming

Continue reading →

Understand Callback function in ServiceNow

In ServiceNow, there is always a need to return GlideRecord on the client side for a specific field  due several reason. for example , checking whether the caller is VIP or no? or to check if the customer has a parent company, and many other reasons depend on the business needs.

Many ServiceNow developers when they do write a script for returning GlideRecord on the client side they do it without a call back function that makes the script runs synchronously causing a hang, while waiting response back from the server.

Continue reading →