how to fetch sysid of current record?

shahebaz5
Kilo Contributor

how to fetch sysid of current record?

1 ACCEPTED SOLUTION

AshishKM
Kilo Patron
Kilo Patron

Hi ,

You can open any record , and get the sys_id from header menu options ( as below )

find_real_file.png

 

If you are trying from some script using GlideRecord , you can get the sys_id of each record from object of GlideRecord ( see the sample code below )

var gr = new GlideRecord('sys_user');
gr.query();
 
while(gr.next()){
// print sys_id
gs.print(gr.sys_id);
 
}
 
Thanks,
Ashish
 
Please hit helpful / or / correct answer , if you find my response worthy based on the impact
 

Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

View solution in original post

7 REPLIES 7

sachin_namjoshi
Kilo Patron
Kilo Patron

Please use below method to get sys_id of current record

 

In Client script

g_form.getUniqueValue();


In business rule

current.sys_id;


Regards,
Sachin

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Serverside: current.getUniqueValue();

ClientSide: g_form.getUniqueValue();

 

//Göran

AshishKM
Kilo Patron
Kilo Patron

Hi ,

You can open any record , and get the sys_id from header menu options ( as below )

find_real_file.png

 

If you are trying from some script using GlideRecord , you can get the sys_id of each record from object of GlideRecord ( see the sample code below )

var gr = new GlideRecord('sys_user');
gr.query();
 
while(gr.next()){
// print sys_id
gs.print(gr.sys_id);
 
}
 
Thanks,
Ashish
 
Please hit helpful / or / correct answer , if you find my response worthy based on the impact
 

Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

AkshayPunekar31
Mega Expert

Hi shahebaz,

 

Refer the below code.

 

In Client Script:

var sysID=g_form.getUniqueValue();

 

In Business Rule:

var sysID=current.getUniqueValue();

 


Please mark reply as Helpful/Correct, if applicable. Thanks!

Warm Regards,

Akshay Punekar

find_real_file.png
www.dxsherpa.com