- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 01:50 PM
I'm not a developer, but I need some guidance.
I am creating a new catalog item for hardware returns.
In the first question, the requestor will select a user from the sys_user table. This will be a reference field and the variable will be 'user_name'.
I want the 2nd question to be a List Collector on the cmdb_ci table. The variable will be 'hardware_returns'. I want the available results to be filtered based on the user selected in question 1. I would like to filter the cmdb_ci table to only show results that match 'assigned_to' fields that match the user selected. This filtering needs to update onchange whenever the user is selected. I would like the requestor to be able to choose multiple pieces of hardware that are assigned to the user they selected.
I've attempted onchange catalog client scripts in conjuction with a script include, but I'm not a developer and I'm relatively cluess. I would just appreciate any help anyone can offer. Thank you!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 03:14 PM - edited 11-20-2023 03:16 PM
Hey, there Matt - no need for a Catalog Client Script to do this. This can be achieved using Reference Qualifiers.
Copy the below into your Reference Qualifier field, add the name of your user field to replace my placeholder text.
javascript:"assigned_to="+current.variables.NAME_OF_THE_USER_FIELD
Note that if your user field is empty on the form, that will impact the filter as well so you probably want to set a default value for it so it at least is the current user when you hit the form for the first time.
Let me know if this doesn't work for you.
P.S. if you want to only show hardware in your List Collector, you probably want to reference the cmdb_ci_hardware class instead of cmdb_ci. cmdb_ci will display every CI in the CMDB as opposed to just hardware.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 03:14 PM - edited 11-20-2023 03:16 PM
Hey, there Matt - no need for a Catalog Client Script to do this. This can be achieved using Reference Qualifiers.
Copy the below into your Reference Qualifier field, add the name of your user field to replace my placeholder text.
javascript:"assigned_to="+current.variables.NAME_OF_THE_USER_FIELD
Note that if your user field is empty on the form, that will impact the filter as well so you probably want to set a default value for it so it at least is the current user when you hit the form for the first time.
Let me know if this doesn't work for you.
P.S. if you want to only show hardware in your List Collector, you probably want to reference the cmdb_ci_hardware class instead of cmdb_ci. cmdb_ci will display every CI in the CMDB as opposed to just hardware.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 06:04 AM
Thank you! This worked perfectly. I appreciate the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 01:57 AM
hi All,
I didn't same setting for my similar requirement and didn't work for me. Can one suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 04:42 AM
Try adding the Variable attribute I mentioned below.
