Hello ServiceNow Users,

Let’s say you want the Initial values of all the fields in the record of a particular table. Many time Iheard from many users, that it is not possible.

But actually, it is possible. ServiceNow provides you a facility to check the initial values of any record even after that record values updated multiple times.

You can follow the below code to get the Initial Values of any record in any table.

Here I am fetching all the incidents whose CI’s initial value is blank or not when initially the incident was created.

vararr=[];

vargrincident=new GlideRecord(‘incident’);

grincident.query();

while(grincident.next())

{
vargrhistory=new GlideRecord(‘sys_history_set’);

grhistory.addQuery(‘id’,grincident.sys_id);

grhistory.query();

if(grhistory.next())

{

var name = gs.getXMLText(grhistory.initial_values,”//cmdb_ci”);

if(name==null)

{

gs.addInfroMessege(‘Incident has No CI initially-‘+grincident.number);

}

else

{

gs.addInfroMessege(‘Incident has CI initially-‘+grincident.number);

}

}

}

Note-You just have to change the field name in above code.

We can also find it out Manually, Here are the Steps

1.Openan Incident record.

2.Right Click on form header >Configure>Related List

Search Initial Value

3.Find “Audit History” related list and bring it on right sidebucket , so that we can get a related list on incident form

Search Initial Value

4.Now, let’s say you want to search value of “Configuration Item” that how many time the value is modified ,what is its initially value, what is current value, etc. You just have to find the incident field label name in label column of history table and right click on that name and click on “Show Matching” to filter the matching record

Search Initial Value
Search Initial Value

Here the number of records are 3 means 3 times value of “Configuration Item” is modified, with the “old” and “new”field you will get to know that what are the new and old values of that particular field.

Similarly, you can also group that record to find data of every field.

Author ,

Yash K.Agrawal

ServiceNow Consultant

Emergys Blog

Recent Articles

  • Migrating from Remedyforce to BMC Helix

    Enhance Your IT Service Management: Migrating from Remedyforce to BMC Helix

    Enhance Your IT Service Management: Migrating from Remedyforce to BMC Helix

    In today’s rapidly evolving business landscape, organizations must constantly seek [...]

    In today’s rapidly evolving business landscape, organizations must constantly seek ways to optimize their IT service [...]

  • Credit Unions to Accelerate Growth with Cost-Effective Hyperautomation

    Credit Unions to Accelerate Growth with Cost-Effective Hyperautomation

    Credit unions are grappling with evolving customer expectations, economic uncertainty, [...]

    Credit unions are grappling with evolving customer expectations, economic uncertainty, and growing competition from fintech startups, [...]

  • Unlocking the Power of Data Warehouse Migration

    Unlocking the Power of Data Warehouse Migration

    Unlocking the Power of Data Warehouse Migration