Menu

Problem while using ExternalKeys

2022-11-29
2022-12-01
  • Javier Galdeano Rodríguez

    Hey! So I've got a problem trying to implement different types of external fields from others classes. The thing I'm getting is the one showed in the photo named "How to solve?". Thing is that, that is the Object Type, but I want to show the name of the object itself.

    Also, the class where I'm showing the field is:

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.6">
    <classes>
            <class id="Centro" _delta="define">
                <parent>cmdbAbstractObject</parent>
    
                <properties>
                    <category>bizmodel,searchable</category>
                    <abstract>false</abstract>
                    <key_type>autoincrement</key_type>
                    <db_table>centro</db_table>
                        <db_key_field>id</db_key_field>
                        <db_final_class_field/>
    
                    <display_template/>
                        <icon>images/ICONO_CENTRO.png</icon>
    
                    <reconciliation>
                        <attributes>
                            <attribute id="nombre"/>
                            <attribute id="IdGPACentro"/>
                            <attribute id="org_id"/>
                            <attribute id="organization_name"/>
                        </attributes>
                    </reconciliation>
                </properties>
    
                <fields>
                    <!-- SUS ATRIBUTOS -->
                    <field id="nombre" xsi:type="AttributeString">
                        <sql>nombre</sql>
                        <default_value/>
                        <is_null_allowed>false</is_null_allowed>
                        <display_style>radio_horizontal</display_style>
                    </field>
                    <field id="IdGPACentro" xsi:type="AttributeInteger">
                        <sql>IdGPACentro</sql>
                        <default_value/>
                        <is_null_allowed>true</is_null_allowed>
                        <display_style>radio_horizontal</display_style>
                    </field>
    
    
                    <!-- ATRIBUTOS DE UBICACIÓN -->
                    <field id="ubi_id" xsi:type="AttributeExternalKey">
                        <sql>ubi_id</sql>
                        <target_class>Ubicacion</target_class>
                        <is_null_allowed>false</is_null_allowed>
                        <on_target_delete>DEL_MANUAL</on_target_delete>
                    </field>
    
                    <field id="ubi_name" xsi:type="AttributeExternalField">
                        <extkey_attcode>ubi_id</extkey_attcode>
                        <target_attcode>nombre</target_attcode>
                    </field>
    
                    <!-- ATRIBUTOS DE ORGANIZACIÓN -->
                    <field id="org_id" xsi:type="AttributeExternalKey">
                        <sql>org_id</sql>
                        <target_class>Organization</target_class>
                        <is_null_allowed>false</is_null_allowed>
                        <on_target_delete>DEL_MANUAL</on_target_delete>
                    </field>
    
                    <field id="organization_name" xsi:type="AttributeExternalField">
                        <extkey_attcode>org_id</extkey_attcode>
                        <target_attcode>name</target_attcode>
                    </field>
                </fields>
            <methods></methods>
    
            <presentation>
                <details>
                    <items>
                        <item id="nombre">
                            <rank>10</rank>
                        </item>
                        <item id="org_id">
                            <rank>20</rank>
                        </item>
                        <item id="ubi_id">
                            <rank>30</rank>
                        </item>
                    </items>
                </details>
                <search>
                    <items>
                        <item id="nombre">
                            <rank>10</rank>
                        </item>
                        <item id="org_id">
                            <rank>20</rank>
                        </item>
                        <item id="ubi_id">
                            <rank>30</rank>
                        </item>
                    </items>
                </search>
                <list>
                    <items>
                        <item id="nombre">
                            <rank>10</rank>
                        </item>
                        <item id="org_id">
                            <rank>20</rank>
                        </item>
                        <item id="ubi_name">
                            <rank>30</rank>
                        </item>
                    </items>
                </list>
            </presentation>
            </class>
    </classes>
        <menus>
            <menu id="ConfigManagementOverview" xsi:type="DashboardMenuNode" _delta="must_exist">
                <definition>
                    <cells>
                        <cell id="4" _delta="if_exists">
                            <dashlets>
                                <dashlet id="122" xsi:type="DashletBadge" _delta="define">
                                    <rank>10</rank>
                                    <class>Centro</class>
                                </dashlet>
                            </dashlets>
                        </cell>
                    </cells>
                </definition>
            </menu>
        </menus>
      <user_rights>
        <groups>
        </groups>
        <profiles>
        </profiles>
      </user_rights>
    </itop_design>
    
     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-11-29

    Check https://www.itophub.io/wiki/page?id=latest:customization:xml_reference
    Classes > class > properties > naming

    PS: I'd advise you to stay close to Combodo conventions (English field names + capitalization which you have done correctly); and just translate into (I assume) Spanish using the dictionary files :)

     
  • Javier Galdeano Rodríguez

    Thanks! That was the issue.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.