How to call a script include and return the result to a catalog variable

nakamura323
Kilo Guru

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
スクリーンショット 2024-03-20 220706.png

Question Choice table

スクリーンショット 2024-03-20 223534.png

 

Call script include.

"variables.---_test_employee_company" is the company catalog variable

スクリーンショット 2024-03-20 220551.png

 

script include; Query the sys_user_group table for names containing the string of the received argument.

スクリーンショット 2024-03-20 220505.png

 

Group selection (no company selected)

スクリーンショット 2024-03-20 224241.png

 

Group selection (select company)

スクリーンショット 2024-03-20 224300.png

 

In this case, why don't I see anything with the string BK in its name?

thank you.

 

1 ACCEPTED SOLUTION

nakamura323
Kilo Guru

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.

 

View solution in original post

12 REPLIES 12

nakamura323
Kilo Guru

Checking the log shows 'com.glide.script.RhinoEcmaError: "ComNam" is not defined.'

A message was displayed.

This is the Reference qualifier I think this means that the argument cannot be passed to the script include.

javascript: new ---test_IdDepartmentUtil().GetComNamQuery(current.variables.---test_employee_company);

This is a reference qualifier call statement, is there a problem?

The part following current.variables is the name of the catalog variable.

Is that correct?

HI @nakamura323 your script include must be server side. not client callable

Regards
Harish

nakamura323
Kilo Guru

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.