Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to get the label of the choice list to check the condition in email script

hitman
Kilo Contributor

hi all

        i want to use label of the choice list in the email script without using the values..

thanks

hitman

553931pradeepdjpradeepksharma

3 REPLIES 3

Chuck Tomasi
Tera Patron

Hi Hitman,



I would recommend against this as labels are subject to change and ARE different in multiple languages. The purpose of the choice list value is to avoid all those headaches.



Can I ask why you are interested in doing a label comparison?



FWIW, you can get the label by using <object>.field.getDisplayValue()


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Hitman,



You can GlideRecord the table sys_choice (name = tablename, element = field name) and that will give you the Label of the field.


Please let us know if you have any questions/concerns.


Mihir Mohanta
Kilo Sage

Hi Hitman,



getDisplayValue() function returns the label name of a choice list.



Suppose a choice list label is "Draft" and its value is 1 and it is in the state field of incident.Then


current,state (returns 1)


current.state.getDisplayValue() (returns Draft)




Thanks,


Mihir