Menu

Unknown attribute from class between two custom extensions

2022-02-24
2022-02-24
  • Juan Palacios

    Juan Palacios - 2022-02-24

    Hello friends I hope you can help me

    I am creating some extensions in itop but I have some doubts or small problems and I think it is because I am new and I have only guided myself from the documentation on the wiki.

    I made an extension to register a vehicle which has a number_vehicle assigned (it works fine without problems).
    I'm making another extension to create a device that goes inside the vehicle. As an example, I can tell you a POS.

    This device (POS) have: name, org_id, status, business_criticity, brand_id, model_id, serialnumber but need to have the number_vehicle creating on the firts extension, i just call the item id on the datamodel.

     <item id="number_vehicle">
                  <rank>50</rank>
     </item>
    

    My problem is that when uploading the extension to the toolkit it generates an error “Unknown attribute number_vehicle from class POS“
    I am using itop 3.0.0 and toolkit 3.0.0

     
  • Vincent @ Combodo

    You must declare under class POS
    1. a field "vehicle_id" as externalKey to the class Vehicle to specify in which vehicle your POS is installed
    2. Then a field "number_vehicle" as an ExternalField based on "vehicule_id" and field "number_vehicle" from the remote class pointed by "vehicule_id" which would automatically display in the POS object a property of the Vehicle object

     
  • Juan Palacios

    Juan Palacios - 2022-02-24

    Thanks Vincent,

    It worked just like you told me
    But I realized that I have to make another change,
    In my vehicle class, in addition to the number_vehicle field, which is an internal number, I also have a field called license_plate
    When I call number_vehicle at the POS, it shows me to select among the registered vehicles and if I call the license plate it gives me the option to select as well and this should not be selectable, it should show me the license_plate associated with the number_vehicle, I don't know if you understand me.

    I put the code I use.

    <field id="number_vehicle" xsi:type="AttributeExternalKey"> 
              <sql>number_vehicle</sql>
              <is_null_allowed>true</is_null_allowed>
              <on_target_delete>DEL_AUTO</on_target_delete>
              <target_class>vehicle</target_class>
    </field>
    <field id="licence_plate" xsi:type="AttributeExternalKey"> 
              <sql>licence_plate</sql>
              <is_null_allowed>true</is_null_allowed>
              <on_target_delete>DEL_AUTO</on_target_delete>
              <target_class>vehicle</target_class>
    </field>
    

    I appreciate your help

     

    Last edit: Juan Palacios 2022-02-24

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.