
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on ‎09-19-2020 04:32 PM
ADD Button is not like a traditional related list Button i.e. Edit, New. As the Add button opens up a Pop-up instead of a slush bucket so the default filters using List Controls don't work. The Good News is, this can be achieved by modifying the OOTB Script Include. [Make sure to Assess and accept/reject upgrades to this script include post upgrade]
Story
Put a Default Filter on Impacted CI's Related List on the Change Request form to show only those CI's which doesn't have STATUS = RETIRED when I click on ADD Button.
Solution
The backend functionality of the ADD button is controlled by a Script Include AssociateCItoTask. We are going to add an encoded query to apply as a filter.
1. Go to the cmdb_ci table and apply a filter on List based on your requirements. Right-click on the filter and select a copy query. This copied query will be used in the script include, in our next step.
2. Open the AssociateCItoTask Script include. Inside function _getUrl(), On line # 35, add the below line of the script.
url.set("sysparm_query", 'install_status!=7');
Please note - Line number can be different but make sure you group the above line with the existing url.set(..) method.
3. Save the Script Include and then open any change request. Scroll down to Impacted Services/CI related list and click on the ADD button. You will see a default filter there.
Hurrah! We are done. 🙂
If this was helpful, please make sure to give it a thumbs up [HELFPFUL]. Also, bookmark this for future reference.
Visit my PROFILE for other good articles, that you might love.
- 4,129 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you so much for this community post as I have spent lot of time to find the solution for this.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Rachit - Happy that you found it helpful!

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This was awesome. I am not a Java Scripter, but I was able to easily implement this to filter by the column 'sys_class_name'. This was such a benefit as it allowed me to hide Classes that will only confuse our Users today (I will change this filter later, when we're ready to reveal more CI Classes). Thank you!

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I am glad that helps, Thanks!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello Muhammad
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
Is there any way to achieve the same approach in the service operation workspace?
Thanks & Best Regards,
Raymond
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
a new query added on line 35 i wanted to works only for change requests impacted ci related list and not for incidents related list how do we achieve this ?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
Is the solution still valid?
I noticed there is a code changed compared to the original post 5 years ago