We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Ho to fetch different value of "choice field" in system property

Parul Sahu
Tera Contributor

Hi All,

 

As there are different choices available in "choice field" of system property out of box i see. How can i fetech the different value presnt in choice field like "problem_coordinator" 

What is the way of doing that ? 

ParulSahu_0-1671715307939.png

 

5 REPLIES 5

RaghavSh
Giga Patron

Run below code in background script, you will get the choices.

var prop = new GlideRecord('sys_properties');
prop.addQuery('name','problem.closed.role.reanalyze_from_completed');
prop.query();
if(prop.next())
{
gs.print(prop.choices);
}

There is no direct way to get choices as we have for values through gs.getProperty('problem.closed.role.reanalyze_from_completed');
Please mark the answer correct/helpful accordingly.

 

 


Raghav
MVP 2023
LinkedIn

@Parul Sahu is this working for you now as expected output?


Raghav
MVP 2023
LinkedIn

Hi Raghav, 

Can we directly use choice field ?

 

@Parul Sahu what is your exact requirement? I have provided the script to get it, you can use that anywhere.

Since it has comma separated choice field, it will return all.


Raghav
MVP 2023
LinkedIn