- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2016 06:32 AM
I'm having issues to get the display values of two fields in a client script.
g_form.getDisplayValue('field_name') will return the number of the incident and not the actual display value of the field.
The fields I need the display values for is State (state) and Configuration Item (cmdb_ci).
From what I read in other threads you should use
g_form.getDisplayBox('field_name').value;
When I try this I get an error instead on the form when the Client Script is triggered
The code I'm using in the onChange client script is the following
var state = g_form.getDisplayBox('state').value;
alert(state);
The alert won't show, only the above error is displayed.
Any ideas what I could do to get the Display Value of the state field?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2016 07:21 AM
Did you try this?
var u_stateValue = g_form.getValue('state');
var u_stateLabel = g_form.getOption('state',u_stateValue).text;
PS - Please mark Helpful, Like, or Correct Answer if applicable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2016 06:40 AM
Hi Fredrik,
Your description is a bit contradictory. You start out asking for the number of the incident, but mention a reference field, then talk about state (which is a choice field.) i'm confused. Can you clarify what the underlying object is to this exercise?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2016 06:45 AM
It's friday afternoon , sorry for the confusion.
What I need is to get the display value of two fields, state is the first one and the second one is Configuration Item (cmdb_ci).
I get the same issue with booth fields when I try to get the display value.
EDIT: Updated the first post in the thread

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2016 06:51 AM
Out of curiosity, what release of ServiceNow are you on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2016 06:55 AM
We are using Helsinki patch 0 hotfix 1