Based on the model populate the assets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2024 03:02 AM
In this scenario, the catalog task contains the 'Model' field (table: cmdb_model) and the 'Asset' field (table: alm_asset), which are reference fields. Based on the selected model, assets should populate. I am using an advanced reference qualifier, but the script below is not working. Can you please provide the correct script
Script inculde:
Thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2024 03:30 AM
Hi,
You shouldn't need to use a script include call - you'd also run into a limit with returning a string of sys_ids as you could be returning thousands of records
Instead
javascript: 'model =' current.variables.name_of_variable_for_model
You then need to add the following into the variable attributes
ref_qual_elements=variable_name_for_model
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2024 03:34 AM - edited ‎11-25-2024 03:48 AM
Can you clarify if you have added model and asset fields to the sc_task table, or are these variables in the Catalog Item? If they are variables, use current.variables.var_name in the reference qualifier. Based on your scenario, it sounds like you want to pass the selected model to the Script Include, but it looks like you are passing the asset? If you are still not getting expected results you can add some temporary gs.addInfoMessage lines to the Script Include to confirm the value passed in from the qualifier, and see if any records are retrieved by the GlideRecord.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2024 03:38 AM
model and asset fields to the sc_task table only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2024 03:54 AM
The approach by @Kieran Anson is better in this scenario - without the .variables. since this is a field on the table, and you need to concatenate:
javascriptt: 'model=' + current.u_model
of course with just one t in javascriptt