Script include return value not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 01:08 PM
Hi All,
I am modifying a catalog in which I have
Variable 1: List collector variable name "Application" in which i am gliding "cmdb_ci_business_application".
Variable 2: Environment which is select box having choices with, production, DEV, QA so on..
The requirement is based on the variable 1 and 2 the variable 3 should populate the value with certain condition.
The 3rd variable "Application server" is list collector which is to query value from custom table "u_m2m_servers_applications". The values from variable 1 and 2 to be passed to M2M table and we have to pick the related server.
For instance in the M2M table iam querying application with environment there will be some 5 values which will be matching, and will be showing in list collector of variable 3. I dont want to list down the retired / decomm.
The challenging is the server should not be retired or decommission.
From the reference qualifier we can able to pass the value of variable 1 and 2. But we cannot put the condition for DOTWALKING the server status information.
So i tried using a script include to fetch the value. But i am stuck with return value how to pass it back to variable. Please find my script below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 01:24 PM - edited 10-24-2023 01:28 PM
A reference qualifier on a list collector (or reference) variable that calls a Script Include should return the value 'sys_idIN' + a comma-separated list of sys_ids on the referenced/list table of the desired records. This is best done by pushing the sys_ids to an array in the Script Include, then returning the joined array after 'sys_idIN'. So your Script Include needs to take whatever variables you pass into it and come up with a list of sys_ids to push to an array.
Also, since this is a List Collector type variable, be sure to use the Variable attribute like ref_qual_elements=var1,var2 naming each variable where a new value should cause the list filter to update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 01:30 PM
Thanks for your Reply Brad. But my script on the function parameter is working
relatedServer: function(application, environment) {
But the glide with m2m table is not working. Am i missing something? Since i cannot see the logs when i tried.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 01:42 PM
Make sure the Script Include is Client callable. Are you seeing the 'AK function call' and 'AK function inner test param' logs? Add more logs to see where the script is not getting the correct if statements or GlideRecords. Even if/when the SI works completely, your final statement is 'return;' which isn't going to resolve to the reference qualifier anything useful - it needs to return 'sys_idIN' + a comma-separated list of sys_ids from the list table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 01:51 PM
Hi Brad,
Yes, I can see first 2 logs. Now i will try with returning this through array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2023 12:38 PM
Hi @AnandKumar1 ,
Just checking , if your problem resolved now. Please share the issue area ( if resolved ).
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution