This documentation supports the 11.1 version of BMC Discovery.

To view an earlier version of the product, select the version from the Product version menu.

Displaying custom attributes

The BMC Discovery data model allows additional attributes to be added to nodes. You should only ever add additional attributes to inferred nodes. You must never update DDD nodes.

Attributes might be added by patterns at any point in time. It is strongly recommended that you add attributes at creation time when building your own inferred nodes. Inferred nodes that were created by the system must be modified using a separate pattern.

Once you have modified the node it is necessary to make the attribute visible. You do this by defining a display attribute:

 

To display the custom attribute on the node view using model.addDisplayAttribute

You can add the newly created attribute, or list of attributes, to those displayed on the node page using the model.addDisplayAttribute function. For example, to display the server_name attribute, use the following:

if si.server_name then
      model.addDisplayAttribute(si, "server_name");
end if;

Similarly, to display multiple attributes from a list named list_attrs, use the following:

      list_attrs :=[]; // list of attribute names
      if si.port then
         list.append(list_attrs, "port");
      end if;
      if si.server_name then
         list.append(list_attrs, "server_name");
      end if;
   model.addDisplayAttribute(si, list_attrs); 

Using underscore to format display

If the attribute name contains some underscore ("_") characters, they will trigger a string format of the attribute when displayed. For example, the server_name attribute above will be displayed as "Server Name".

To remove the custom attribute from the node view

You can remove attributes that you have created, or a list of attributes that you have created, from those displayed on the node page using the model.removeDisplayAttribute function. For example, to remove the server_name attribute, use the following:

   model.removeDisplayAttribute(si, "server_name");

Similarly, to remove the attribute list list_attrs, use the following:

   model.removeDisplayAttribute(si, list_attrs);
Was this page helpful? Yes No Submitting... Thank you

Comments