I have a question releated to Link Tables in iTop. We're using the newest version (2.7).
We have the wish that there's a Link Table between the the classes Contract and Order, like the integrated «link table» with the name «Link Contact / Contract (lnkContactToContract)».
Is it possible to create a custom link table? Is there a way to do (best practice) - for example to create a new extension? Are there any examples online for this specific topic or any documentations?
You can totally add a link between 2 objects, it's what make the beauty of iTop! 😍
The best practice is to do so by creating your own extension which will alter the XML datamodel to add the link table ("indirect linkedset" in iTop vocab). Also, as you will alter an XML node brought by another extension, make sure to add a dependency to this module, otherwise it might not compile correctly.
Check here for resources on how to make your own extension.
Here for the XML structure of the AttributeLinkedSetIndirect
You can check this extension of @jbostoen which does plenty but take a look at the functionalcis_list attribute of the Certificate class in the datamodel.jb-certificate.xml file.
Let us know if you are having some trouble while making it :)
Hope this helps,
Guillaume
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for this great feedback! I was able to create the indirect linkedset between the Order and the Contract class - very cool and nice feature. Also the extension from jbostoen is amazing.
At least, in iTop in when I go to the «Data Model» section everything looks fine :)
But if I go to the database and do a select statement on the new table:
select * from lnkcontracttoorder
The database (MySQL) give me an error, that the table «lnkcontacttoorder» is not existing.
Did I forget something to declare / create in the extension?
I did a lot of tests to reproduce the error, but still there's no table in the MySQL-Database.
Did you find something strange on the code or is there something more to do?
You can find the actual code from the extension in the attachment.
Did you find something strange or wrong in my question and the attached code? The generation of the database-table is not working automatically on our iTop instance.
What's your suggestion to this topic? Should we create the table manually direct on the database with the two foreign-keys?
Have a pleasant evening.
Thanks for the support!
Fabian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for hitting an old thread but I am having the same sort of problem and was wondering if you ever could get the table(Class) created via the toolkit..?
Thnx.
-K
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the datamodel viewer, if you open the "Order" class and go to the "Related classes" tab, you will see that the "lnkContractToOrder" link doesn't appear like the others.
When you open the datamodel.xxx.xml file of your extension (thanks for posting it btw), we can see that in the "Order" class, you commented the "contract_list" field with the "lnkContractToOrder" table and replaced it a few lines lower with another "contract_list" field with a "lnkCertificateToFunctionalCI" table. That's the problem.
Remove the second "contract_list" field, uncomment the first one and it will be ok. (That being said, the field isn't in the "details" presentation, so you won't see the tab. You might want to add it)
Hope this helps,
Guillaume
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I created an lnk between Location to Provider Contracts, but I don't see the tab Provider Contracts in Location screen .I don't have any error during the installation process
Hello,
I've just installed your XML (by the way, prefer add the content as an attachment if it's longer than a few lines of code), and I can see the object is created through the data model viewer.
But indeed no extra tab in the ProviderContract object...
For this tab to appear, you'll need to add in each Location and ProviderContract classes a new AttributeLinkedSetIndirect. See how it's done for AttributeLinkedSetIndirect for example...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good day community,
I have a question releated to Link Tables in iTop. We're using the newest version (2.7).
We have the wish that there's a Link Table between the the classes Contract and Order, like the integrated «link table» with the name «Link Contact / Contract (lnkContactToContract)».
Is it possible to create a custom link table? Is there a way to do (best practice) - for example to create a new extension? Are there any examples online for this specific topic or any documentations?
Thanks for the support!
Regards
Hello Fabian,
You can totally add a link between 2 objects, it's what make the beauty of iTop! 😍
The best practice is to do so by creating your own extension which will alter the XML datamodel to add the link table ("indirect linkedset" in iTop vocab). Also, as you will alter an XML node brought by another extension, make sure to add a dependency to this module, otherwise it might not compile correctly.
Let us know if you are having some trouble while making it :)
Hope this helps,
Guillaume
Hi Guillaume
Thanks for this great feedback! I was able to create the indirect linkedset between the Order and the Contract class - very cool and nice feature. Also the extension from jbostoen is amazing.
At least, in iTop in when I go to the «Data Model» section everything looks fine :)
But if I go to the database and do a select statement on the new table:
The database (MySQL) give me an error, that the table «lnkcontacttoorder» is not existing.
Did I forget something to declare / create in the extension?
Here is my code:
Last edit: Fabian 2020-06-03
Hello Fabian,
Glad to hear you managed to make the link!
Did you make your own extension or did you tweak Jeffrey's?
In your config file, did you set a table prefix for the database?
Sharing the whole extension could help o troubleshoot.
Guillaume
Hi Guillaume
Thanks for the support.
I did the changes on an extension created by our company. You can find our extension in the attachments.
Regards
Fabian
Last edit: Fabian 2020-06-04
Good day Guillaume
I did a lot of tests to reproduce the error, but still there's no table in the MySQL-Database.
Did you find something strange on the code or is there something more to do?
You can find the actual code from the extension in the attachment.
Thank you very much for the support.
Regards Fabian
Hi Guillaume
Did you find something strange or wrong in my question and the attached code? The generation of the database-table is not working automatically on our iTop instance.
What's your suggestion to this topic? Should we create the table manually direct on the database with the two foreign-keys?
Have a pleasant evening.
Thanks for the support!
Fabian
Dear Fabian.
Sorry for hitting an old thread but I am having the same sort of problem and was wondering if you ever could get the table(Class) created via the toolkit..?
Thnx.
-K
Hello Fabian,
In the datamodel viewer, if you open the "Order" class and go to the "Related classes" tab, you will see that the "lnkContractToOrder" link doesn't appear like the others.
When you open the datamodel.xxx.xml file of your extension (thanks for posting it btw), we can see that in the "Order" class, you commented the "contract_list" field with the "lnkContractToOrder" table and replaced it a few lines lower with another "contract_list" field with a "lnkCertificateToFunctionalCI" table. That's the problem.
Remove the second "contract_list" field, uncomment the first one and it will be ok. (That being said, the field isn't in the "details" presentation, so you won't see the tab. You might want to add it)
Hope this helps,
Guillaume
Hello,
I created an lnk between Location to Provider Contracts, but I don't see the tab Provider Contracts in Location screen .I don't have any error during the installation process
Here is the code:
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<classes>
<class id="user-content-lnkLocationtoContract" _delta="force">
<parent>cmdbAbstractObject</parent>
<properties>
<is_link>1</is_link>
<category>bizmodel</category>
<abstract>false</abstract>
<key_type>autoincrement</key_type>
<db_table>lnklocationtocontract</db_table>
<db_key_field>id</db_key_field>
<db_final_class_field>
<naming>
<attributes>
<attribute id="user-content-location_id">
<attribute id="user-content-providercontract_id">
</attribute></attribute></attributes>
</naming>
<display_template>
<icon>
<reconciliation>
<attributes>
<attribute id="user-content-location_id">
<attribute id="user-content-providercontract_id">
</attribute></attribute></attributes>
</reconciliation>
</icon></display_template></db_final_class_field></properties>
<fields>
<field id="user-content-location_id" xsi:type="AttributeExternalKey">
<sql>location_id</sql>
<target_class>Location</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
</field>
<field id="user-content-location_name" xsi:type="AttributeExternalField">
<extkey_attcode>location_id</extkey_attcode>
<target_attcode>name</target_attcode>
</field>
<field id="user-content-providercontract_id" xsi:type="AttributeExternalKey">
<sql>providercontract_id</sql>
<target_class>ProviderContract</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
</field>
<field id="user-content-providercontract_name" xsi:type="AttributeExternalField">
<extkey_attcode>providercontract_id</extkey_attcode>
<target_attcode>name</target_attcode>
</field>
</fields>
<methods>
<presentation>
</presentation></methods></class></classes></itop_design>
<items>
<item id="user-content-location_id">
<rank>10</rank>
</item>
<item id="user-content-providercontract_id">
<rank>20</rank>
</item>
</items>
<search>
<items>
</items></search><profiles>
</profiles>
Hello,
I've just installed your XML (by the way, prefer add the content as an attachment if it's longer than a few lines of code), and I can see the object is created through the data model viewer.
But indeed no extra tab in the ProviderContract object...
For this tab to appear, you'll need to add in each Location and ProviderContract classes a new AttributeLinkedSetIndirect. See how it's done for AttributeLinkedSetIndirect for example...
Hello,
thank you I will test