how to retrieve state options from sc_req_item table?

sai krishna25
Kilo Contributor

I am trying to show the list of option that is available for the 'state' field options in the sc_req_item. The highlighted onefind_real_file.png

3 REPLIES 3

Ahmmed Ali
Mega Sage

Hello Sai,

 

Right click on state field and select configure dictionary.

 then in field configuration form, at bottom related list, you will get choice. there usually you will get choice for other tables which extend task table. there you can select for the table sc_req_item.

 

Thanks,

Ali

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

sai krishna25
Kilo Contributor

Hello Ali,

 

Thanks for the information. It was exactly what I was looking for. Is there anyway, I can get those choices using an API?

 

Regards,

Sai

Hello Sai,

 

this can be done with table API. but in rest API explorer the table with name starting with sys_ are filtered out. so we need to build table API with referirng to other table API.

I did one below.

https://Instance_name.service-now.com/api/now/table/sys_choice?sysparm_query=name%3Dtask%5Eelement%3Dstate%5Elanguage%3Den%5Einactive%3Dfalse&sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_fields=element%2Clabel%2Ctable%2Cvalue

OOTB no choice are defined for sc_req_item table. so it takes values from task table. so i gave table as task (in query above name%3Dtask%). if you have defined for sc_req_item then you can replace task with sc_req_item. else can use the same as above.

I tried it and will give response as below.

find_real_file.png

 

let me know for any query.

 

Thanks,

Ali

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali