How would I filter for this on a related list/control

Josh80
Tera Expert

There is a custom field on our Task table for 'affected CIs'. This enables a related list on CI tables/forms that I called 'Affected CI Incidents' and 'Affected CI Change Requests'.

Since 'affected CIs' automatically includes the primary Configuration Item field value, I need a way to to filter out any records (changes / incidents) whose configuration item field value is listed in the 'affected CI' related list.

For example, if CI_ABC is on the Change Request form's 'Configuration Item' field, that Change request will be listed under the new 'Affected CI Change Requests'. I need the filter to look at the CI field and if it matches any of the values in the 'Affected CI Change request' list, in this case CI_ABC, filter it out.

Thanks for any help.

1 ACCEPTED SOLUTION

One minor change, use "CONTAINS" for the second addQuery();



current.addQuery("cmdb_ci","!=",parent.sys_id);


current.addQuery("u_affected_cis","CONTAINS",parent.sys_id);


View solution in original post

25 REPLIES 25

Abhinay Erra
Giga Sage

Creates two relationships as shown below.


Creating Defined Related Lists - ServiceNow Wiki



For Incident related list:


1.PNG



For change related list:


2.PNG




Then open cmdb_ci list and right click on the form go top configure-> Related lists and add these two related list as shown in the snapshot.



find_real_file.png


Hi - I think since the reference/slushbucket field exists directly on the


Change not just in the relationship/related list, I should be able to say


exclude records where the affected CI matches the configuration item value.



This is just a bit of a weird one.


Thanks



On Fri, Aug 5, 2016 at 4:08 PM, abhi_r <community-no-reply@servicenow.com>


I am not sure if I understood your requirements correctly.


For example, if CI_ABC is on the Change Request form's 'Configuration Item' field, that Change request will be listed under the new 'Affected CI Change Requests'. If this is what you want, my solution will work.


Oh - I think the images didn't come through.



So are you saying my related list will become invalid with yours replacing


them?




On Fri, Aug 5, 2016 at 4:30 PM, abhi_r <community-no-reply@servicenow.com>