Deepak Ingale1
Mega Sage

NOTE: MY POSTINGS REFLECT MY OWN VIEWS AND DO NOT NECESSARILY REPRESENT THE VIEWS OF MY EMPLOYER, ACCENTURE.

Believe it or not, it's been always a pain (for me at least) to troubleshoot client side issues / bugs / order of execution for catalog client scripts. However, going through Jakarta release notes https://docs.servicenow.com/bundle/jakarta-release-notes/page/release-notes/it-service-management/se... , came across the new listed feature "Variable action logger" and thought to experiment around it. Docs site does not provide in detailed steps about this feature which demanded me to experiment around this.

I am sharing below findings related to this excellent and much needed feature based on experiments carried out and hope you will find it helpful.

        1) Enable variable action logger: Under Service Catalog application, we can now find new module "Enable variable action logger". Click on this which enables this feature.

find_real_file.png

        2) At background, clicking on the module sets "glide.sc.log.variable_actions" property value to "true" and flushes cache. Hence, do not change this on your PROD instance since it will result in cache flush and rebuilding it again which may create performance issues.

        3) For testing, I built a new catalog item "Jakarta variable action logger" with 3 variables namely short_description, description and requester.

        4) Once done, created a simple catalog client script to set short_description as mandatory and requester variables as read only.

find_real_file.png

find_real_file.png

        5) Now, having catalog variable action logger turned on, I was wondering where does logging happens since docs site does not have any info. So, I enabled developer tool (F12 function key for enabling browser developer tools) and was expecting to have log statements comings up on console tab. However, that was not the case (sad, right?)

        6) Thought it may come in syslog table and went to search there but could not find any. (Though to give up on exploring further since no clue where would logging info go apart from obvious two places syslog table and console tab on developer's tool.)

        7) Before deciding to give up, just right clicked on the header of the catalog item form and found a nice little option "Show variable action logger". (Cannot tell the happiness in words after seeing it J)

find_real_file.png

        😎 Once clicked on action, a little popup window appeared on the form listing down name of the catalog client script which got fired (order 1 ) along with actions that script took on variables requester ( Order 1.1 ) and short description ( order 1.2)

find_real_file.png

        9) Thought to make it more interesting and introduced new catalog UI policy to make description variable as mandatory.

find_real_file.png

find_real_file.png

        10) Clicked on "show variable action logger" option and could see details about catalog UI Policy as well (Order 2) and actions are listed in order 2.x

find_real_file.png

        11) Also, notice the timing of the scripts, client script took 15ms for setting read only and mandatory compared to UI policy 2ms. ( ServiceNow best practise to use UI Policy for better performance !!! )

        12) Notice the order of execution, client script 1st (order 1) and then UI Policies (Order 2) ( Client scripts gets executed first and then UI polies, not always though A Race between UI Policy and Client script   )

find_real_file.png

Some of the extra feature it provides

a) Ability to clear the log so that you can refresh the form page and re test client scripts.

b) Ability to export these details in CSV format

c) Order ( 1st column ) in which scripts are getting triggered.

7 Comments