Menu

Any way to create new field types (like AttributeExternalKey)

2025-07-11
2025-07-16
  • Jacques Dancause

    Hey there,

    Our team is currently wondering if there's a way to add a new field type to iTop. A way to have a new option, like how we have AttributeString, AttributeExternalKey, we'd like to create our own. Is there any way to do this through an extension?

     
  • Vincent @ Combodo

    In theory it is possible since version 3.1, but there isn't any documentation about this option.
    We are not sure that it will cover all cases (REST, DataSynchro, test in OQL, Portal,...)

    Here are the new attribute types that we have created this way :
    1. one for defining a 1:1 relationship is still a prototype somewhere and was never released, so hardly tested
    2. the second is public here : https://github.com/Combodo/itop-attribute-encrypted-password
    3. And there was also a repo for showing an example: https://github.com/Combodo/sample-new-attribute-type

    Don't hesitate to share the results of your investigation

     
    👍
    1
    • Sean Guo

      Sean Guo - 2025-07-15

      Hey Vincent, I used your AttributeEncryptedPassword repo as a guidance and tried to create a new attribute type extending from AttributeExternalKey but when I tried to apply the new attribute type to a field I am stuck with "ERROR missing parameter 'target_class' in AttributeX declaration for class AttributeExternalKey" despite adding those parameters in bose the attribute and datamodel xml file.

      It seems itop isn't recognizing a few parameters like "filter" and "target_class" in my new attribute and I am wondering if you have any tips regarding this issue or this is limited because we are on iTop version 3.0.3 instead of a newer version?

       
      • Vincent @ Combodo

        For sure 3.0.3 is not enough to be able to create new type of Attribute, taht was not supported at that time

         
        👍
        1
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2025-07-12

    It depends what kind of functionality you're looking after.

    For instance, even for iTop 2.7, I created a new field type "AttributeGeometry" and "AttributeCRS".

    What kind of attribute would you like to make?

     
    • Sean Guo

      Sean Guo - 2025-07-14

      Hey, we are on iTop 3.0 and we are mostly trying to create a AttributeExternalKey but without the hyperlink and key tooltip in extensions.

       
      • Jeffrey Bostoen

        Jeffrey Bostoen - 2025-07-14

        What's the main goal if there is no link? You just want to show an ID, or the class and the ID?

        ( if so, you could just use an AttributeInteger type or something ).

         
        • Sean Guo

          Sean Guo - 2025-07-15

          We want to have a field that works exactly like AttributeExternalKey where you can select the keys from dropdown but we want to prevent showing hover ids and disable the hyperlink that points to the selected object from the original class.

          We don't want to modify core methods responsible for generating the hyperlink so we want to see if it's possible to extend a new attribute type from ExternalKey.

           
          • Jeffrey Bostoen

            Jeffrey Bostoen - 2025-07-15

            Hm, since you do want the functionality of an external key...

            Have you considered a different approach; injecting some JavaScript to delete the link and replace it with plain text? (It might very briefly show, then gets replaced immediately)

            If you target the element with the proper element selector, you could do this for specific fields only.

             
            • Stephen Abello

              Stephen Abello - 2025-07-16

              I agree with Jeffrey, you could display your ExternalKey while editing and hide it when displaying the object details with some hacks, and then use an ExternalField based on this ExternalKey to only display a name in the details

               
              👍
              1
            • Sean Guo

              Sean Guo - 2025-07-16

              Thank you for the recommendation, I will we will stick with JS scripts to strip the link for now until we update to the latest version.

               

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.