0
g_form.getUniqueValue();
 getUniqueValue will return the sys_id.
Use of g_form.getUniqueValue() function in client Script ServiceNow
Working Code Edited question July 31, 2023