add filter to a slushbucket list

Efra Pruneda
Mega Guru

I am trying to add a filter to the slushbucket list that shows when the user opens the change request form, goes to the impacted Services/CI related list and clicks on Edit. The requirement I have is to filter out all business services that have been retired (install_status !=7).

I have followed the steps on the link below and but I dont see the edit default filter section.

https://hi.service-now.com/kb_view.do?sysparm_article=KB0720545

I opened a case with SN support and they suggested to follow these other steps (see below), I am an unexperienced ServiceNow admin and have no idea how to create the script required on step 5

1. Navigate to System Definition > Relationships

2. click NEW button

3. Applies to table = task_cmdb_ci_service <-- this I am not sure if it is the right value.

4. Queries From Table = task_cmdb_ci_service <-- SN support told me to provide this table name here

5. In 'Query with' field add your custom code logic. you will need to make a GlideRecord() query to lookup up a cmdb_ci_service record

here is the code I came up with, but is not working

var efr = new GlideRecord('cmdb_ci_service');
efr.addquery('install_status','!=',7);
efr.query();
var efrarr = [];
while (efr.next())
	efrarr.push('' + efr.sys_id);
current.addQuery('sys_id', efrarr);

I will greatly appreciate your help with either method. thank you in advance!

Efra

1 ACCEPTED SOLUTION

I believe this is the issue. In my PDI, UI Policy action hides edit default filter (visible = false)  whenever condition is true but it is reverse in your case.

Can you check history if  this UI Policy is changed recently. You may also try to deactivate this UI Policy and check if it works. I believe field(Edit Default Filter)  will appear in list control, once you deactivate this UI Policy

 

find_real_file.png

View solution in original post

15 REPLIES 15

sachin_namjoshi
Kilo Patron
Kilo Patron

 

There is no need to create any new system relationships.

In your case, I assume that  when user clicks "Add" button on impacted services / CI related list on change record, you want to filter out retired CIs.

For this, you need to update existing OOB script include "AssociateCIToTask" code which has default filter

Update highlighted code in this script include

 

 

 

find_real_file.png

Sachin,

thank you for your reply! I review your suggestion with a coworker here and we think that your idea helps when there is a list list involved not a slushbucket. a clear example are the first two related list tabs in the change request form. the first is to add more CIs to the affected CIs list. you do have an "add" button and when the popup opens it shows a typical SN list. However if you go to the tab I am interested called "impacted services/ci", you dont see an "add" button but an "edit" button and instead of a popup list you get a slushbucket. Do you have any thoughts on how to add a filter to the slushbucket? 

I hope you have additional hints for me and thanks again!

Efra

You can add filter to slushbucket like below example

 

find_real_file.png

Right-click on the related list and go to List Control.

 

find_real_file.png

 

Add the Edit Default Filter field to the form:

 

find_real_file.png

 

Create your Filter:

 

find_real_file.png

 

And it will be a filter:

 

find_real_file.png

 

Regards,

Sachin

Sachin,

sorry, if you see my initial post, I have followed these steps and I do not see the Edit Default filter field. I do not know why. I have triple-checked that the Edit default filter is on the list on the right, but when I click on save. the field is simply not there!