Question on list collector variable

Mani60
Tera Contributor

Hi All,
I have one requirement on catalog item, if list collector choice "other" is select then "specify other" field should be visible.
Could please help me on this, to get the proper solution.

 

Thanks,

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

HI @Mani60 

 

Have a look here

 

https://www.servicenow.com/community/developer-forum/based-on-the-selection-of-other-option-from-the...

https://www.servicenow.com/community/developer-forum/based-on-the-selection-of-other-option-from-the...

 

https://www.servicenow.com/community/developer-forum/to-enable-a-text-box-for-a-choice-selected-for-...

https://www.servicenow.com/community/hrsd-forum/field-other-in-dropdown-menu-with-free-text-field/m-...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

sourav1999
Mega Guru


Sure, you can achieve this by using a client script in ServiceNow. Here are the steps:

  1. Navigate to Service Catalog > Catalog Definitions > Maintain Items.
  2. Open the catalog item you want to modify.
  3. Go to the "Client Scripts" related list and click on "New" to create a new client script.
  4. Set the Type to "onChange", and in the "Depends on" field, select the variable that represents your list collector.
  5. In the "Script" field, enter the following JavaScript code:

javascript
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
// Assuming 'other' is the value for the 'Other' choice in your list collector
if (newValue.indexOf('other') > -1) {
g_form.setDisplay('specify_other', true); // Assuming 'specify_other' is the name of your 'Specify Other' field
} else {
g_form.setDisplay('specify_other', false);
}
}

 

      6. Click "Submit" to save the client script.

 

This script will run every time the value of your list collector changes. If the new value includes 'other', it will display the 'Specify Other' field. Otherwise, it will hide it.

JaeggerLegane
Kilo Sage

Hello Mani,


This can be achieved by creating a UI Policy.

 

Example variables:

JaeggerLegane_1-1704792032244.png


Example UI policy with related UI policy action:

JaeggerLegane_0-1704792001213.png

 




--------------------------------------------------------------------------------
If my post helped you, please click the accept solution button and hit the thumbs up! Thank you!