I'm just wondering if someone could advise on how to create a new tab that looks similar to "Properties" tab for change request (please refer to attached image). I would be very grateful if you could share a simple public extension or sample code regarding this functionality.
Do you want to put some of the class fields in a second tab or do you want to manually create fields from something else ?
First case
In the XML "details" presentation section, you can define a tab just like you define a fieldset, just make sure the "item" ID is "tab:XXX", XXX being the code for the tab.
Second case
To add a new tab and make whatever you want in it, you have to overload the "DisplayBareRelations()" method in your object class (through XML), you can check here for more information.
But the main problem will be that there is no official API for you to display fieldsets and fields. So you will probably mimic that done today, but it might not be compatible with futur upgrades.
Hope this helps,
Guillaume
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much for your help and example code guide. In my case, it would be case #2. I will have a look at overloading the method "DisplayBareRelations()" and get back if there's any issues.
Have a good one!
Regards,
Ray
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much for your help and guidance. I ended up going forward with the case #1 solution. It's working on my side but I have a few questions:
It seems that the new tab is always placed next to the "Properties" tab even though I have adjusted the rank attribute value. Is there any way to change the order of this new tab? Please refer to attached image
<details_delta="redefine"><items><itemid="functionalcis_list"><rank>10</rank></item><itemid="contacts_list"><rank>20</rank></item><itemid="workorders_list"><rank>30</rank></item><itemid="related_request_list"><rank>40</rank></item><itemid="related_incident_list"><rank>50</rank></item><itemid="related_problems_list"><rank>60</rank></item><itemid="child_changes_list"><rank>70</rank></item><!-- Rank is 25, should be between contacts and work orders tab --><itemid="tab:Change:cab"><rank>25</rank><items><itemid="fieldset:Change:cab_chair"><rank>10</rank><items><itemid="cab_chair"><rank>10</rank></item></items></item></items></item>...
</items></details>
2.Unrelated to this topic, however, is there a way to force an optional field to be mandatory (perhaps using JavaScript (i.e. add certain class or attribute to the field))? I understand that in the change lifecycle I could specify field as mandatory for certain state.
However, if I set that field as mandatory in "Planned" state for change request, this field will be automatically prompted when transitioning from "Assigned" to "Planned" state. However, this information is not available when transitioning. It will be available later in the "Planned" state but not when transitioning to "Planned". When it's available, user will simply edit the change which is in "Planned" state and the field should display as mandatory (not optional).
Thank you very much in advance and would be really grateful if someone could share some insights.
Hi All,
I hope all of you are safe and well.
I'm just wondering if someone could advise on how to create a new tab that looks similar to "Properties" tab for change request (please refer to attached image). I would be very grateful if you could share a simple public extension or sample code regarding this functionality.
Thank you very much in advance!
Regards,
Ray
Last edit: ray 2020-11-13
Hello Ray,
Do you want to put some of the class fields in a second tab or do you want to manually create fields from something else ?
First case
In the XML "details" presentation section, you can define a tab just like you define a fieldset, just make sure the "item" ID is "tab:XXX", XXX being the code for the tab.
Second case
To add a new tab and make whatever you want in it, you have to overload the "DisplayBareRelations()" method in your object class (through XML), you can check here for more information.
But the main problem will be that there is no official API for you to display fieldsets and fields. So you will probably mimic that done today, but it might not be compatible with futur upgrades.
Hope this helps,
Guillaume
Interesting, I didn't know about the solution for the first case.
It's not documented and unofficial for now 😁
Hi Guillaume,
Thank you very much for your help and example code guide. In my case, it would be case #2. I will have a look at overloading the method "DisplayBareRelations()" and get back if there's any issues.
Have a good one!
Regards,
Ray
Great! Feel free to reply if you need more information. Have a nice WE :)
Guillaume
Hi Guillaume,
Thank you very much for your help and guidance. I ended up going forward with the case #1 solution. It's working on my side but I have a few questions:
2.Unrelated to this topic, however, is there a way to force an optional field to be mandatory (perhaps using JavaScript (i.e. add certain class or attribute to the field))? I understand that in the change lifecycle I could specify field as mandatory for certain state.
However, if I set that field as mandatory in "Planned" state for change request, this field will be automatically prompted when transitioning from "Assigned" to "Planned" state. However, this information is not available when transitioning. It will be available later in the "Planned" state but not when transitioning to "Planned". When it's available, user will simply edit the change which is in "Planned" state and the field should display as mandatory (not optional).
Thank you very much in advance and would be really grateful if someone could share some insights.
Regards,
Ray
Last edit: ray 2020-11-17
Hello,
I don't think this can be changed...
There are nice tutorials on this in the "customize iTop" section of the documentation : Force a field to be mandatory [iTop Documentation]
Hi Pierre,
Thank you very much for the advise!