The CreatorCon Call for Content is officially open! Get started here.

About choice list specifications

takei
Tera Expert

I created an item with an integer data type and created several choices. I also set the choice list specification to "None".
Then, when I create a record and check the value, the "Value" setting value is displayed instead of the "Label" setting.
If you set the specification of the choice list to "Dropdown with none", the setting value of "Label" is displayed, but is this a specification?
Supplementary note: I changed the "Language" in "Choices" to en or ja, but it didn't change.

 

Thank you in advance.

1 REPLY 1

Amit Gujarathi
Giga Sage
Giga Sage

HI @takei ,
I trust you are doing great.

To address this issue, we need to ensure that the choice list is configured correctly. You mentioned that you set the choice list specification to "None," but the desired behavior is to display the "Label" setting. To achieve this, you should set the specification of the choice list to "Dropdown with none."

Here's an example of how you can modify the choice list specification using ServiceNow's GlideSystem API:

// Get the choice list field from the item
var item = new GlideRecord('item');
item.get('sys_id', 'your_item_sys_id'); // Replace 'your_item_sys_id' with the actual sys_id of your item

// Set the choice list specification to 'Dropdown with none'
item.choices = '1'; // '1' represents 'Dropdown with none' option in the choice list specification
item.update();

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi