- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 06:53 AM
Hello.
I would like to call a script include in the reference modifier of a catalog variable.
Here, I would like to select the company and department to which I belong, and then narrow down the groups I want to browse by "name".
Since the table has values such as BK and FG, it is assumed that only those containing the strings BK and FG will be queried.
Currently I am writing the script with only company variables.
This is a screenshot.
Select company from the Question Choice table
Question Choice table
Call script include.
"variables.---_test_employee_company" is the company catalog variable
script include; Query the sys_user_group table for names containing the string of the received argument.
Group selection (no company selected)
Group selection (select company)
In this case, why don't I see anything with the string BK in its name?
thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2024 07:26 PM
Problem solved.
The cause was that the company selection type was set to reference.
It worked by changing the type to Select Box.
For more information, please visit the URL below.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0749932
https://note.com/rhayahi/n/n14c260f7209f#60a3818c-bc3e-45a5-a09a-e4745da55675
thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 10:07 AM
Check your initialization of the Script Include - just because your script editor is not formatting it exactly like what I am used to seeing:
Is your 'Group selection' variable a reference on sys_user_group? If you manually filter a list view of the Groups table on active = true and name contains BK, how many group records do you see? You can add some gs.addInfoMessage lines (or gs.info if that doesn't work in this case) to the Script Include to make sure it is running (not another SI with the same name) and confirm the value of the argument passed in from the reference qualifier, as well as if the GlideRecord returns any results.
The only other thing I can think of is to try a different array name - maybe 'list' is a reserved word?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 05:54 PM
thank you for your reply.
Is your 'Group selection' variable a reference on sys_user_group?
> Yes.
how many group records do you see?
> 156.
add some gs.addInfoMessage lines
> I added gs.info to the script includes, but it didn't print to the application log.
The only other thing I can think of is to try a different array name - maybe 'list' is a reserved word?
>I'll try a different array name as well.
I don't think "list" is a reserved word.
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 06:38 PM
Hi @nakamura323
I can think of giving the api name instead of just name in your reference qualifier.
you have given it as new u_mids_test_id instead try the api name(you can see below the name field in script include)
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 07:25 PM - edited 03-20-2024 07:26 PM
Hi @nakamura323 after your function add this line
gs.info("SI called==>"+comNam); // check whether your script include is called and the value you passed from reference qual prints in logs? then the next steps can be debugged
I would also advise make it a server side script include rather than client callable.
Harish