Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Change filter on Affected CI Related List

Sean Burton
Tera Expert

I am having a hard time on changing the Affected Ci related list for Change Request. I need to adjust the filter to include Cis from this table - cmdb_ci_web_site. 

 

I think I need to alter script AssociateCIToTask, but I am not sure how. 

 

Any advice is greatly valued.

 

SeanBurton_0-1717509941787.png

 

2 REPLIES 2

Kieran Anson
Kilo Patron

Hi,

Currently your filter looks to be only showing principal classes. To add cmdb_ci_web_site you can set this as a principal class via CI Class Manager (tick the principal class box in below screenshot)

 

Screenshot 2024-06-04 at 16.06.44.png

Thank you for your advice. I ended up doing this...

 

var webSite = 'sys_class_name=cmdb_ci_web_site^discovery_source=AgentClientCollector^operational_status=1';
        var customFilter = new ConfigurationItem().getNonBusinessAppCIsForChanges()+'^category!=Batch^ORcategory=NULL^change_controlISNOTEMPTY^owned_byISNOTEMPTY';
        principalClassFilter += '^' + customFilter + '^NQ' + webSite;