Unable to get value of referance field in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 03:16 AM
I am trying to get value of ref field in client with g_form.getValue("fieldname"); but it returns nothing.
Even g_form.getDisplayBox("fieldname"); gives no value.
All other field values are getting returned in the client script except ref field.
What is alternative.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 03:23 AM
you want to get display value of reference field?
if yes and you are doing this in native and for normal form then this should work fine
var value = g_form.getDisplayBox('fieldName').value;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 07:22 AM
I forgot to add- This is a workspace client script.
var value = g_form.getDisplayBox('fieldName').value; isnt working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 03:25 AM
hello @Snehal13 ,
Did you try alerting the value ?
put that in alert and let me know if its returning the value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 03:35 AM
I get no value in alert