Script Related to Interactive Filter

daware-madhu103
Tera Contributor

Hello I am struggling for scripted interactive filter on the dashboard which has a report on the table (asmt_metric_result). I need to filter the list based on the "Company" and "Department"  by interactive filter.

I have created two interactive filter for both Company and Department field where if Company is A then in the another filter should populate with departments under the Company A. 

Please find the below screenshots for reference.

 

5 REPLIES 5

Community Alums
Not applicable

Hi @daware-madhu103,


It seems that what you are trying to do can be achieved with the Cascade Interactive Filter without scripting.

https://docs.servicenow.com/en-US/bundle/vancouver-now-intelligence/page/use/dashboards/task/create-...

Are Company and Department custom fields? I couldn't find such fields in the Metric Result table on my PDI instance.
If you could tell me more about your table structure, I might be able to give you some advice.

daware-madhu103
Tera Contributor

Yes. In Metric result table Company and Department fields are dot walked fields coming form assigned_to.company and assigned_to.department.

Please find the attached screenshot.

Community Alums
Not applicable

Here is an example for implementing with Cascade Interactive Filter:

  • Navigate to All > Reports > Administration > Interactive filters and click New.
  • In the Filter based on list, select 'Cascading Filters'.
    cascading filter.png
  • Right-click the form header and select Save.

  • Define the first level of the cascading filter.
    • In the Cascading Filter related list, click New.
    • Select Company [core_company] as the Table and Name as the Display field.
      Company filter.png
    • Right-click the form header and select Save.
    • In the Target Tables related list, click New.
    • Select Metric Result [asmt_metric_result] as the Target table and 'Assigned to > Company' as the Field.
      Company Target Tables.png
    • Click Submit button.

  • Define the second level of the hierarchy.
    • From the first level of the cascading filter, in the Cascading Filter related list, click New.
    • Select Department [cmn_department] as the Table and Name as the Display field.
    • In the Parent Reference Field field, select the field that contains the value selected from the higher-level filter.
      Department filter.png
    • Right-click the form header and select Save.

    • In the Target Tables related list, click New.
    • Select Metric Result [asmt_metric_result] as the Target table and 'Assigned to > Department' as the Field.
      Department Target Tables.png
    • Click Submit button.

  • Place the Cascade Interactive Filter and Metric Result report on the same dashboard. Department is filtered by the value selected for Company.
    dashboard.png

@Community Alums  Thanks for the help. Its working!