
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2015 02:38 PM
In our CMDB certain CIs having more than thousand related CIs and hence when we load a CI form it takes a lot of time to open that form. I was trying to remove the CI relationship formatter from the form and displaying it as a Pop-up in the click of an UI action. But I'm not able to find ci_relations.xml under UI macro. It seems it's written in source code. Any suggestions to achieve this functionality ? How to invoke ci_relations.xml as a pop-up from UI Action ? I tried calling it as a UI macro from a UI page but it didn't work.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2015 08:20 AM
Hi Sachin, I think GT is providing 2 different solutions in his answer - giving you some choices.
I spent quite a bit of time researching this for you and there is actually no way to put the ci relationship element in a popup or to load it after the form context. The way that it's built requires global jelly variables from GlideContext that can't be recreated in another context. so... here are a couple of alternatives.
- Good Idea: Create a different view, and put the ci relationships in that view but switch back to the default view when you don't want to see them.
- Better Idea: Create a new formatter that acts as a wrapper for the CI Relations formatter. This wrapper would control whether or not to show the CI Relations based on a querystring parameter. Here's an example:
- Create a new ui macro called: Load CI Relationships
With the following XML:<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<tr>
<td>
<j2:if test="$[sysparm_show_relations == 'true']">
<g:inline template="ci_relations.xml"/>
</j2:if>
<j2:if test="$[sysparm_show_relations != 'true']">
<button id="load_ci_relations">${gs.getMessage('Load CI Relations')}</button>
<script>
$('load_ci_relations').on('click', function(event){
Event.stop(event);
var redirectLocation = window.location.href;
var hashLocation = redirectLocation.indexOf('#');
if (hashLocation > 0)
redirectLocation = redirectLocation.substr(0, hashLocation);
window.location.href = (redirectLocation + '$[AMP]sysparm_show_relations=true');
});
</script>
</j2:if>
</td>
</tr>
</j:jelly> - Follow this guide to create a new formatter following this guide: Creating a Formatter - ServiceNow Wiki
- Name: Load CI Relationships
- Table: Configuration Item [cmdb_ci]
- UI Macro: Load CI Relationships
- Type: Formatter
- Add this formatter to your CI form by modifying your form layout like GT suggested:
Then you will see a form like this:
And when you click on that button... shazam...
Not a perfect solution, but you should be able to make it work reasonably well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2015 04:50 PM
You can find it under System UI > Formatters.
To remove permanently, personalize > form layout and remove User CI Relations (later named CI Relations) from the slushbucket.
Not the popup solution, but to show/hide via a client script (very hacky)
var p = $$('#root_node_xml')[0].parentNode;
p.style.display = 'none';
To turn back on:
p.style.display = '';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2015 07:08 AM
Hello Giora,
this will hide the relationship from the form but still load it, which will not solve the problem.
any other sokution ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2015 08:20 AM
Hi Sachin, I think GT is providing 2 different solutions in his answer - giving you some choices.
I spent quite a bit of time researching this for you and there is actually no way to put the ci relationship element in a popup or to load it after the form context. The way that it's built requires global jelly variables from GlideContext that can't be recreated in another context. so... here are a couple of alternatives.
- Good Idea: Create a different view, and put the ci relationships in that view but switch back to the default view when you don't want to see them.
- Better Idea: Create a new formatter that acts as a wrapper for the CI Relations formatter. This wrapper would control whether or not to show the CI Relations based on a querystring parameter. Here's an example:
- Create a new ui macro called: Load CI Relationships
With the following XML:<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<tr>
<td>
<j2:if test="$[sysparm_show_relations == 'true']">
<g:inline template="ci_relations.xml"/>
</j2:if>
<j2:if test="$[sysparm_show_relations != 'true']">
<button id="load_ci_relations">${gs.getMessage('Load CI Relations')}</button>
<script>
$('load_ci_relations').on('click', function(event){
Event.stop(event);
var redirectLocation = window.location.href;
var hashLocation = redirectLocation.indexOf('#');
if (hashLocation > 0)
redirectLocation = redirectLocation.substr(0, hashLocation);
window.location.href = (redirectLocation + '$[AMP]sysparm_show_relations=true');
});
</script>
</j2:if>
</td>
</tr>
</j:jelly> - Follow this guide to create a new formatter following this guide: Creating a Formatter - ServiceNow Wiki
- Name: Load CI Relationships
- Table: Configuration Item [cmdb_ci]
- UI Macro: Load CI Relationships
- Type: Formatter
- Add this formatter to your CI form by modifying your form layout like GT suggested:
Then you will see a form like this:
And when you click on that button... shazam...
Not a perfect solution, but you should be able to make it work reasonably well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2015 07:52 AM
Thanks a lot Will Leingang. you provided me a perfact solution. you saved me