One option to be selected from List collector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 11:03 AM
Hi ServiceNow Expert,
I have a requirement on list collector field, there are N number of option (Read, write and execute) that can be selected.
For example : There are three options: Codw read, codw write and codw execute. When user selects codw read, codw write and codw execute should disappear or hidden. Same works when codw write is selected (hide codw read and codw execute)
Please assist me on this.
below code written but doesn't work:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 12:27 AM
Hello PK14 ,
Can you please let me know which table List collector is referencing ?
In my case , Just for testing I'm referencing it to "Question choice" table and I'm able to achieve this.
Step 1 : Create Catalog Item Variable
Name : Access
Type : List Collector
List Table : Question Choice
Reference Qualifier :
javascript:
if (current.variables.access) {
/* If any value selected in List collector then don't show other values*/
"question=2eb25ddac3897110ab85241ce0013134^value=" + current.variables.access;
} else {
* If List collector is empty or removed selected value from list then show all values*/
"question=2eb25ddac3897110ab85241ce0013134"; // sys_id of "Access" variable
}
Step 2 : Create 3 question choices in Question choice table as per scrrenshot
1.Read
2.Write
3.execute
Output :
Test case 1 : List collector is empty i.e no value selected then show all Read,write,execute
Test case 2 : If you select "Read" then "Write" and "Execute" will not display
Same for other
You can use same logic for your case ....!!
Hope this will help you..!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates