OnChange Client Script to Populate List Collector

Steven Parker
Giga Sage

So I am playing around in my personal Dev instance and trying to populate a list collector with a few values based on the choice in a Select Box variable:

find_real_file.png

How can I populate multiple values in the right bucket of a List Collector when a Select Box is changed (job_function in this example) to a certain value?   This works for populating 1 value, although it throws up a JavaScript error in the Service Portal which is obviously an issue.   I know the values that need to go in the right bucket when a value is chosen in the select box so I just want to manually populate those 3 or 4 values when the job function is changed to "fsr".   Also, what is causing the JavaScript error on the Service Portal?


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
10 REPLIES 10

Anurag Tripathi
Mega Patron
Mega Patron

Hey Steven,



Have you seen this, look at the comments below the post


https://www.servicenowguru.com/scripting/client-scripts-scripting/move-list-collector-options/


-Anurag

That did help somewhat...I modified my code a little and am now looking in a table.   This is working in the back end perfectly:



find_real_file.png



But the Service Portal is throwing up this error:


find_real_file.png



Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

So I have the script doing exactly what I want it to do in the ITIL view in the backend:



find_real_file.png



But the Service Portal is throwing me a JavaScript error.   This is in my Personal DEV Instance so I don't know if our normal Dev instance would be any different, but does anybody see anything wrong with this from a Portal perspective?



Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Steven Parker
Giga Sage

Still seeking some help here for this OnChange script:



Still have 1 issue.   This works in the ITIL view of Service Now, but how do you make this work in the Service Portal?



Here is the ITIL view when FSR is the Job Function:


find_real_file.png



Here is the Service Portal view where nothing happens:


find_real_file.png



Please mark this response as correct and/or helpful if it assisted you with your question.
Steven