We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Configuration Item Display Value Override for Specific CI Class (cmdb_ci_file_system)

LivashanN
Tera Contributor

Hi Community,

 

I’m currently working through a requirement and would really appreciate insights or alternative approaches from anyone who may have faced something similar.

 

Requirement:

On the Incident [incident] form, we would like the Configuration Item (cmdb_ci) field to display a different value — but only for a specific CI class:

  • For records of class cmdb_ci_file_system
  • Instead of showing the default name field (inherited from cmdb_ci)
  • We want to display the value from the comments field

Important: This should only apply to cmdb_ci_file_system records — all other CI classes should continue to use the default display value behavior and we should not change the value in the name field of the record.


Challenge:

As most of you know, the display value of a reference field is driven by the Display Field on the referenced table (in this case, cmdb_ci hierarchy), which makes conditional display behavior quite tricky.

 

What Has Been Attempted:

I’ve explored several approaches, but none have successfully achieved the desired outcome:

1. Dictionary Override on Display Field

  • Tried creating a dictionary override on the name field
  • Attempted to disable or alter the display behavior for cmdb_ci_file_system
  • Result: Did not override the inherited display value as expected

2. Dictionary Override with Calculation

  • Attempted to define a calculated value via dictionary override
  • Result: No impact on how the display value is rendered in reference fields

3. Script Include + Client Script

  • Built logic to dynamically fetch and force the display value (comments)
  • Used client-side methods to try and override the reference field display
  • Result: UI may temporarily reflect changes, but gets overwritten by system display logic

4. New Field as Display Value

  • Created a custom field and set it as the Display Field for cmdb_ci_file_system
  • Result: Still overridden due to inheritance from cmdb_ci (base table display field takes precedence)

 

Key Question

Has anyone successfully implemented conditional display values for a reference field based on the CI class?

Specifically:

  • Overriding display value behavior only for a child class
  • Without affecting the global display field for all CMDB records

 

Looking for Guidance:

If anyone has:

  • Implemented a similar requirement
  • Found a workaround or pattern
  • Or can confirm platform limitations in this area

Your input would be greatly appreciated!

 

 

4 REPLIES 4

shubhamseth
Giga Sage

@LivashanN 

 

I can think of something as below: Give try: 

 

1. Use GlideAjax / UI formatter (Recommended)

Instead of changing cmdb_ci display value:

  • Keep reference field unchanged
  • Add a UI formatter or UI macro
  • Dynamically show:
    • comments if class = cmdb_ci_file_system
    • else name

This is the cleanest UI-only approach.

 
2. Add a “Display Alias” field (Best Practice)

Create:

  • u_display_name

Populate using Business Rule:

if (current.sys_class_name == 'cmdb_ci_file_system') {
    current.u_display_name = current.comments;
} else {
    current.u_display_name = current.name;
}

Then:

  • Use this field in reports / lists / UI instead of overriding cmdb_ci

 

Issue resolved? → Mark as Correct


Found value? → Mark as Helpful


Thank you, i will look into Option 1 as a possible solution and see if it will work for this scenario, however  option 2 will not work for this scenario as this is not only needed for reporting purposes and list view, also we don want to replace the default name field as this can cause other issues.

 

The preferred option would be to just the display value showing as the comment filed instead of the name field in the default field configuration_item on the Incident form.

@LivashanN Sure, please try option 1 which fits your requirement. Please accept the solution if it solved your queries so that it can be benifits to others.

 

 

Issue resolved? → Mark as Correct


Found value? → Mark as Helpful


AshishV39002515
Tera Contributor

Hi @LivashanN ,

 

I would recommend to try the below approache -

 

1.Dynamic Display Value using a Display Business Rule-

 

Create a Business Rule on cmdb_ci_file_system:

g_scratchpad.displayName = current.comments;

Then use a client script on Incident to replace the displayed text after selection.

Example:

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue)
return;

var ga = new GlideAjax('CIDisplayAjax');
ga.addParam('sysparm_name', 'getDisplay');
ga.addParam('sysparm_sysid', newValue);
ga.getXMLAnswer(function(answer){
g_form.setValue('cmdb_ci', newValue, answer);
});
}

Script Include:

var CIDisplayAjax = Class.create();
CIDisplayAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getDisplay: function() {
var sysId = this.getParameter('sysparm_sysid');

var ci = new GlideRecord('cmdb_ci');
if (ci.get(sysId)) {
if (ci.sys_class_name == 'cmdb_ci_file_system') {
return ci.comments.toString();
}
return ci.name.toString();
}
return '';
}
});

 

Please mark this as Correct Answer/Helpful if it helped you.

Regards,

Ashish Verma