Posts

Tagging/Marking Your Instance

Did it ever happen to you that you developed something on dev instance but tested on another OR accedently you created something directly on prod/test just because you didn't notice that the record you are modifying is not of dev. If yes, then don't blame yourself, as this is common mistakes that almost all developers have done at some point of time, who works on multi-instance tools like servicenow where you have one instance for development, other for testing and separate one for production. So, is it possible that while making change to any record I can have something that remind me of the instance other than looking at the URL?  Answer is yes. One solution that I used to have in my intitial days, it used to help but was not very effective. I used to change the theme of all the instances so let's say OOB theme for production, blue for development and green theme for test instance. But this is effective only when you open records in the frame of the servicenow main page.

The Year changer - YYYY

Image
                                               The year changer YYYY Did you know that the year format yyyy and YYYY are not same? Although round the year you would find both format working for you in the same way but, when the year is to end and there is a transition of the year to happen, at that time you may get the unexpected result if you do not choose the right format. So, what's the difference ? Let's discuss this. yyyy - This format represents the calender year. Now what does it mean? It means this format evaluates the year part as the year in which day and month of the date lies. You would say it's a waste of time, I already know this, what's new. I agree, till this point nothing new but, let's see the other format YYYY -  This format represents the 'year of the week'  or to simplify, year of the last day of the week. Wait, Does it mean any thing? Yes, it does. To understand the meaning of it, let's take an example :  var Date = new GlideDate(

docs.servicenow.com - Consuming Information In A New Way

Image
                           How to consume docs.servicenow.com We all use docs.servicenow.com, but do we really know how to better use it for learnig things in servicenow. It's fascinating how servicenow has evolved over time and also the way it's learning process has evolved. Now we have learning.servicenow.com, developer.servicenow.com to have a hands-on practicle knowledge of different modules. There is one question that I am often asked by people who want to learn new things in servicenow, "I want to learn so much new things, but don't know from where to start". If they go to docs.servicenow.com , they find informations scattered, so they are not sure from where to start and where to end. Here I am sharing a way, how you can better use servicenow doc for learning topics in a  sequential way so that you can start right and end right. This way of using servicenow doc has been from the time of wiki.servicenow.com and fortunately it has not changed, it's still

query() - What we do not know

Image
               Do you know that query() method of GlideRecord object accepts parameter as well. Many of us may say that ofcourse I know at client side query() methods accept callback function as a parameter which makes it asynchronous. That's right but is that all, what about server side ? Recently I was going through servicenow docs and was surprised to see that at server side also query() method accepts parameter and that parameter is:  'filter condition'. Yes, you read it right, it takes filter condition as a parameter. Although I couldn't find any documentation around it, so did some searching around it and let me tell you all that I could find, how to use it, where it can be used, and it's limitation. At server side query() method accepts two paramaters first the field name and second the field value.  Let's see an example: var gr = new GlideRecord ( "incident" ); gr . query ( "priority" , "2" ) gs . print ( gr . getRowCou
Image
Coloring the Relationship in Dependency View We all have seen the Mono-Chrome look of the dependency view previously called BSM map.  Do you know, you can color code the relationship in the dependency view? Servicenow do gives this capability where you can color code different types of relationship in different color. Below is the way to do it. 1. Go to table Edge Colors [bsm_edge_color] and create a new record 2. Select the type of relationship that you want to color and select the desired color and save the form And that is all you needed to do. Now you can open any CI's dependency view and in whichever CI that relationship is there, it will be color coded. From the above example, in whichever CI's dependency view  Depends on::Used by relationship is there, it will be color coded in green

Demystifying Inbound Email Action Processing

Image
Inbound action is all about how servicenow responds when an email is received by the system. Based on the logic inbuilt in the system, email received is categorized as new/forward/reply, and then continues the processing.   What triggers inbound and what’s the frequency In every two minutes servicenow runs a schedule job named Email Reader. It connects to the mail server using the account specified in Email Properties. The Email Reader downloads any incoming message that is waiting on the mail server and creates email.read events . After the instance processes the events, the inbound actions run. Based on the logic inbuilt, it identifies whether email received is new/forward/reply.                Identification of the Sender of the email Servicenow identifies the user who sent the email based on the email id of the sender. As soon as servicenow receives the email, it matches the sender’s email id with all the user’s email id in the user table. if there is any match found t

Debugging Client Script in ServiceNow - All you need to know

Image
  Hello all Readers,   I have seen many developers struggling and killing lots of their productive time in finding error/bugs in the code. Often they have no clue why the hell their code is not working the way it should. Now there could be 'N' number of reasons why your code migh not work, but how to know  ?    The most approached way I have seen that developers follow is using  alert()  method or  console.log()  method. This approach is no doubt helpful but, what if you are not sure at which line of code you are having data processing issue? You may end up with multiple alert messages and unknowingly you may end up irritating other people who are working on the form, as those alerts will popup on their screen as well    So, is there a way I can debug my client side code silently without using alert(s) and without bothering anyone else ?? Ofcourse,  YES !!!!   Before we go on to the soultion. Lets go to the basics of execution platform of client and server code.    Server side