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.

delete choice lists other than english language

ChaimaA
Tera Contributor

Hello,

how can we remove all choice list associated to the install_status field which are not defined as english. The goal is to keep only english 

Regards 

1 ACCEPTED SOLUTION

Hi @ChaimaA ,

If it works with the background script, then use the script i gave.

 

Thanks,
Sandeep Dutta

Please mark the answer correct & Helpful, if i could help you.

View solution in original post

8 REPLIES 8

SANDEEP DUTTA
Tera Patron
Tera Patron

Hi @ChaimaA ,

If a requirement is to return only English related choice for the entire instance without customizing other configurations to query only English.

we can achieve this by the before-query business rule

- Create a business rule on the 'sys_choice' table
- Enable checkbox 'Query'
- set with least order as '1' - to run this business rule first for sys_choice
- No condition needed
- The below script restricts only choices with the English language to return on an instance for everyone. This way any script using sys_choice can query only English language choices and other scripts don't require modifications.

(function executeRule(current, previous /*null when async*/) {

current.addEncodedQuery('languageSTARTSWITHen');

})(current, previous);

 

From KB: How to restrict only to show specific language choices on instance - Support and Troubleshooting

 

Thanks,
Sandeep Dutta

Please mark the answer correct & Helpful, if i could help you.

Hello Sandeep

It 'dosen't work , when i unable checkbow query , all query remove .

Hi @ChaimaA ,

This field is not available once you open the form of the business rule, once you click on "Advanced" the "Query" field opens up :

SANDEEPDUTTA_1-1748868085516.png

 

 

Thanks,
Sandeep Dutta

Please mark the answer correct & Helpful, if i could help you.

When I save ,it dsappear