Get the Sys_id of choice List Values

Rakshanda Kunte
Tera Contributor

Hi All,

 

Can we get the Sys_id of Choice Values?

 

i.e. we have state field on Incident form and, have choice = "Open", so can we get the sys id of this "open" record?

Sys_id of Open record is : 91464cb521120110a866589604c20d9a

 

RakshandaKunte_0-1683025758507.png

 

 

 

9 REPLIES 9

@Ankur Bawiskar ,

 

Written below Script Include and Cat Client Script, still no output from Script include.

 

Script Include:

 

RakshandaKunte_0-1683105950196.png

 

Catalog Client Script:

RakshandaKunte_1-1683105994049.png

 

@Ankur Bawiskar ,

 

I tried with getUniqueValue(), but it returns the sysid of main catalog item not the choice values.

 

Community Alums
Not applicable

Hi @Rakshanda Kunte ,

 

To get the sys_id of a Choice Value in ServiceNow, you can follow these steps:

  1. Navigate to the Choice List record for which you want to get the sys_id. This can be found by searching for "Choice Lists" in the navigator and selecting the relevant record.

  2. In the Choice List form, find the choice value for which you want to get the sys_id.

  3. Right-click on the choice value and select "Copy sys_id" from the context menu.

Alternatively, you can also retrieve the sys_id using a ServiceNow API. Here's an example REST API request you can use to retrieve the sys_id for a specific Choice Value:

 

php
https://<your-instance-name>.service-now.com/api/now/table/sys_choice?sysparm_query=name=<choice-list-name>^value=<choice-value>&sysparm_fields=sys_id

 

Replace <your-instance-name> with your ServiceNow instance name, <choice-list-name> with the name of the choice list you're working with, and <choice-value> with the specific value for which you want to retrieve the sys_id.

This API request will return the sys_id of the choice value in JSON format. You can use this sys_id for further processing in ServiceNow.

dericwu
Tera Expert

Hi Rakshanda,

 

So if I understood what you meant, we can do this.

 

1) Open an Incident Record and right-click the State Field. Click on Show Choice List

dericwu_2-1683027256973.png

 

2) This should open the Choice List records in a list view. Scroll down to the Incident table in this scenario.

dericwu_3-1683027347689.png

 

3) From here you can right-click each Label in the Label column and Copy sys_id.

dericwu_4-1683027418909.png

dericwu_5-1683027434984.png

 

in my case - In progress is xxx4b9619e2, On Hold is xxx4b9619e4.

 

Hope this helps!

dericwu
Tera Expert

1) Open an INC record and right-click the State to Show Choice List

dericwu_0-1683028516623.png

 

2) This will open the Choice List records. Locate the Table, in this case Incidents and locate the respective States in the Label column.

dericwu_1-1683028549563.png

 

3) For each Label, right-click and Copy sys_id. This way you can find out the sys_id for a state in a specific table.

dericwu_2-1683028604474.png

dericwu_3-1683028605815.png

 

Hope this helps!