How to filter incident ci to show assigned to ci but keep the all option

flsn2
Tera Expert

Hi guys

 

Got a requirement to make a filter when agent click on the ci variable to get the list view pre filter so the caller id on incident is pass to the assigned to on the ci list view.

 

Ive tried so much options script include,client script..

 

Nothing works.

 

I'm able to create a script include and an override reference qualifier but then you only see the ci assigned to the caller. and this half of the requirement they still whant the ability to reset it while having the caller id populated to im kind a lost

 

Any help would be appreciated thx

 

 

2025-01-25_21h13_19.png

2025-01-25_21h13_33.png

  

2 REPLIES 2

Community Alums
Not applicable

Hi @flsn2 ,

  1. Override the Reference Qualifier: Use a dynamic reference qualifier to filter CIs based on the "Caller" ID on the Incident form.

  2. Use a Script Include for Dynamic Filtering: Create a Script Include that dynamically generates the filter query.

  3. Enable Reset Capability: Allow the user to reset the filter to view all CIs.


Implementation Steps

1. Override Reference Qualifier

Edit the dictionary entry for the CI field (cmdb_ci or the respective variable) and configure the Reference Qualifier as "Dynamic."

2. Create a Script Include

Create a Script Include to generate the filter query dynamically based on the "Caller" field. The Script Include should look like this:

 

 

var GetFilteredCIList = Class.create();
GetFilteredCIList.prototype = {
    initialize: function() {},
    
    getFilter: function(current) {
        // Ensure "Caller" is available
        if (!current.caller_id) {
            return ''; // Return no filter if Caller is empty
        }

        // Build the filter
        var callerId = current.caller_id.toString();
        return 'assigned_to=' + callerId; // Filter CIs assigned to the caller
    },

    type: 'GetFilteredCIList'
};

 

 

3. Configure the Reference Qualifier

In the dictionary entry of the CI field (or the variable in the catalog item), set the Reference Qualifier to:

 

 

javascript:GetFilteredCIList.getFilter(current);

 

Hi @Community Alums 

Thanks for the help

 

Just want to clarify your response

 

#1 So where should i changed this and what config do i need to put ?

As you can see on the picture this is the oob config i got on the cmdb_ci reference

 

2025-01-27_13h30_03.png

 If i decide to change the Use reference qualifier for dynamic i need to create something?

 

#2 i'm able to create the script include so this is ok.

 

#3 where should i put the reference would it be under the reference qual variable or the override reference qualifer for incident table since there is an override. like on this picture 

 

2025-01-27_13h34_55.png

 

 

 Thanks a lot!!!