UI Action script is unable to read the sys_id of incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 11:22 PM
I have created a UI Action on incident table .in UI Action Script i have written the below
var incident_sysid=g_form.getValue('sys_id');
alert(incident_sysid);
it returning null value

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 11:26 PM
Hi @Ketan Pandey, g_form.getValue() can only deliver fields which are visible on form. Sys_id isn't. Try g_form.getUniqueValue() instead. Check the API here: https://docs.servicenow.com/en-US/bundle/vancouver-api-reference/page/app-store/dev_portal/API_refer....
Greets
Daniel
Please mark reply as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 11:36 PM - edited 08-27-2023 11:37 PM
Hi @Ketan Pandey ,
While creating UI action check the client as true
Include your client code in function and call that function onclick as below and use g_form.getUniqueValue():
function doSubmit(){
var incident_sysid=g_form.getUniqueValue();
alert(incident_sysid);
}
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 11:40 PM
How to get the referance field value,please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 11:45 PM
What you exactly want only the value(i.e, sys_id) or display value of the field