Menu

Possibility to link a objects based on name and not id?

2020-10-05
2020-10-06
  • michal.bruncko

    michal.bruncko - 2020-10-05

    we can use "AttributeLinkedSet" to link objects of different class to my class using external key as id of my object. this is ok.
    but it is possible to do the same link, but not using my object ID as reference for external key, but object name instead?
    if so, how can I achieve this?
    thanks

     
  • Vincent @ Combodo

    If you mean to store in the database a link based on the name instead of the id, then the answer is no. You can use the name to import the relation, but iTop will translate it into an id. Name can be changed, while id cannot, this garantee that iTop can maintain the database integrity. If you store the name in the relation as the reference, and then change the name of the object, the relation is broken and your relation is hanging in the air. That's why id were invented!

     
  • michal.bruncko

    michal.bruncko - 2020-10-06

    hello Vincent
    yes, I got the point of id. my request is simply as an consequence of creation of custom objects for specific corporate processes, where the object could represent various device type (drop down selection) and the name itself is free text filled by end user as a part of the process (basically this object could represent also something, which is not in CMDB at all, thats why it is free text).
    my idea was simply relate such objects with real equipment in CMDB based on the name - i.e. if user potentially fills this "custom" object with name string which equals to CMDB object name like PC, then I would like to see this object (list of such custom objects) as a tab within PC properties window. I am able to construct OQL, but there is no structure which could I use to get that objects listed... thats was the point of my question. so mostly is not about integrity (I am not really relating these objects eachother), but rather to have a opportunity to get something listed if there's match based on string.
    anyway I understand now that this is not possible.

     
  • Vincent @ Combodo

    Hi Michal,
    You are trying to build kind of a fuzy relationship based on name. It depends when and how you want to use that relation, if you want it usable in OQL, then it's not possible unless you truely create it with ids. If you just need to display it when you open an equipment object, that can be done in PHP within a custom tab of the equipment object which would at display time run a query on custom objects to see if there are some which reference that equipment by its name and if yes, display them in that tab.

     
  • michal.bruncko

    michal.bruncko - 2020-10-06

    thanks Vincent! looks like I am getting older as it seems I was playing with this kind of lists some years ago... https://sourceforge.net/p/itop/discussion/922360/thread/122764de/
    thanks again, consider as a resolved!

     

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.