Question on list collector variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 12:19 AM
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 01:09 AM
HI @Mani60
Have a look here
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 01:15 AM
Sure, you can achieve this by using a client script in ServiceNow. Here are the steps:
- Navigate to Service Catalog > Catalog Definitions > Maintain Items.
- Open the catalog item you want to modify.
- Go to the "Client Scripts" related list and click on "New" to create a new client script.
- Set the Type to "onChange", and in the "Depends on" field, select the variable that represents your list collector.
- 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 01:22 AM
Hello Mani,
This can be achieved by creating a UI Policy.
Example variables:
Example UI policy with related UI policy action:
If my post helped you, please click the accept solution button and hit the thumbs up! Thank you!