Reference qualifiers and Related List Configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
I’m working through two scenarios involving reference qualifiers and would really appreciate some guidance or confirmation from the community.
1. ✅ Change Table – CI Reference Qualifiers on Configuration Item and Affected CIs
On the Change Request table (change_request):
I’ve successfully added a simple Reference Qualifier to the Configuration Item field (which references cmdb_ci).
However, I also need to apply the same filter to the Affected CIs related list (which references the task_ci table.
❓My Question:
How do I apply the same reference qualifier/filter to the Affected CIs lookup? Is there a way to reuse the same filter logic or is this a separate config?
If separate, where exactly can I apply the filter for the ci_item field in that related list?
2. 🎯 Incident Table – CI Filtering Based on Category
On the Incident table (incident), there’s a requirement that:
When the Category is set to "Application", only Application CIs (from the appropriate cmdb_ci_application class) should be selectable in the Configuration Item field.
❓My Question:
How can I make the cmdb_ci lookup dynamic based on the Category field value?
Would I use an Advanced Reference Qualifier with a script like this?
Is current.category valid in this context or would a Script Include and g_form.getValue() approach be better?
Any help or examples would be greatly appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
51m ago
Be very careful here. What you probably want to do is apply a Dictionary Override to the Configuration item field, not change the Reference qual condition on the Dictionary Entry. Just to be clear, notice when you right-click the Configuration item field on the Change request form and select Configure Dictionary, the Dictionary Entry for this field shows that it actually resides on the task table. Anything you change on this form will apply everywhere the field is used - incident, problem, change, possibly RITM and SCTASK,... If you only want to change the qualifier for the change_request table, what you need to do is first make sure you're on the advanced view on the Dictionary Entry form. Change the Use reference qualifier from Simple to Advanced. Copy the value (encoded query) that now displays in the Reference qual field for use later, then put the Use reference qualifier and Reference qual condition fields back the way they were before you changed anything likely Simple and no conditions. Save the form, then look on the Dictionary Overrides Related List view the record for change_request, or click the New button if there is not one. On the change_request Dictionary Entry Override form, you want to check the Override reference qualifier box, then paste the qualifier you previously copied into the Reference qualifier field. Save this record. Now you have correctly altered the reference qualifier on Configuration item for only the change_request table.
To change the Affected CI related list, I'm assuming you mean when you click the Edit... button, you want the Collection list of CIs to be filtered by this same logic, rather than able to select any CI as it is out of the box. To do this you first need to find and copy the Edit... UI Action, then change the script. In the list of UI Actions that you can reach from the left nav, filter on Name= edit... and you see more than a couple of entries. Filter on the Global table and you're down to 2. The one that says Many to Many in the Comments is the one you want. Change the Table on this record to task_ci, then right-click in the form header and choose Insert and Stay. Now you have a copy of this UI Action that only applies to the Affected CIs related list. In the Script field, add one or both of these lines somewhere like just after the sysparm_stack line
uri.set('sysparm_query', 'install_status=1');
uri.set('jvar_no_filter', 'true'); // added new
Substitute 'install_status=1' for your encoded query. The second line will hide the Filter so that it cannot be changed.
To filter incident CIs based on category, you can call a Script Include passing in the current.category value, but in this simple example something close to your attempt will also work. In either case this would also be a Dictionary Override. Try something more like this:
javascript: var ret = ''; if (current.category == 'application') { ret = "sys_class_name=cmdb_ci_application"; } ret;
Make sure it starts with javascript and the colon character, not whatever the editor shows.