How to exclude retired relationship from related items list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 07:50 AM
Hi,
How to exclude retired relationship from related items list.
If the "Operation status" is set to "Retired" then the those relationship show not list in the Related Items. Could you please suggest is there anyway to filter the related item by "Operation status".
There is a formatter "User CI Relations" which use the Inline template "ci_relations.xml". How we can filter the relation in this template.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<!-- Using existing BSM function to determine the browser compatibility -->
<g2:evaluate var="jvar_compatibility">
SNC.BSMCompatibility.checkCompatibility();
</g2:evaluate>
<!-- If blocked, show old version of relation formatter -->
<j2:if test="$[jvar_compatibility == 'block']" >
<g:inline template="ci_relations.xml"/>
</j2:if>
<!-- If allowed, show new version -->
<j2:if test="$[jvar_compatibility == 'allow']" >
<g:inline template="ng_ci_relations.xml"/>
</j2:if>
</j:jelly>
Regards
Mallikarjun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 04:01 AM
Hi Mallikarjun,
All the items in "Related Items list" that you have here are in 'cmdb_rel_ci' table.
You can write a UI Action (or by any other means) a code that delete such kind of CIs (with retired relationship) from your related list or better say from 'cmdb_rel_ci' table.
For example the code below is an Ajax Include Script that add a specific CI (Cis from Traficgroup) to my current CI via a UI Action.
You can change the code to reach your requirement. It means here I wanted to add some CIs to my current CI, but you should delete some CIs that are retired:
var u_AjaxScripts = Class.create();
u_AjaxScripts.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
addTrafic: function() {
var myparent = this.getParameter('sysparm_myparent');
var mytype = this.getParameter('sysparm_mytype');
var mychild = this.getParameter('sysparm_mychild');
var gr = new GlideRecord('cmdb_rel_ci');
gr.initialize();
gr.parent = myparent;
gr.type = mytype;
gr.child.sys_class_name= 'x_lobl_traficgroup';
gr.child= mychild;
gr.insert();
return 'ok';
},
});
I hope it can help you.
Regards
Alireza