how to print filed :state value in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 03:14 AM
State values: open,closed,pending change,known error
i have tried
var val = g_form.getValue('state');
g_form.addInfoMessage("state "+ val);
--->getting 1/2/3 depending on state value
to get numeric value var val=g_form.getIntValue('state'); is enough
so how to print state filed value in text ex:pending change

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 06:48 AM
Hi Venkat,
I have worked earlier, so I have just did. In general earlier statement will pick up the choice list value record and we are just taking the label values You can rename the label to text also. It will also work
http://wiki.servicenow.com/index.php?title=Client_Scripts#gsc.tab=0
2) g_form.showFieldMsg, alert, g_form.showErrorBox() are available.
Refere Scripting Alert, Info, and Error Messages - ServiceNow Wiki for more info
3) g_form.getValue() used to get the values in the client side and getDisplayValue() is used at server side, normally while doing gliderecord operaration.
Please mark my answer as correct, if it answer your query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 04:06 AM
Hello Venkat,
try this:
var val = g_form.getDisplayValue('state');
g_form.addInfoMessage("state "+ val);