Menu

Prefill Search Form from the creation_from_editinplace

2026-08-13
2026-08-14
  • Samuel Diaz Vigil

    Hi,

    I have a question about the creation_from_editinplace option in iTop 3.2.

    For example, in the Incident class I have the following field:

    <field id="user-content-functionalcis_list" xsi:type="AttributeLinkedSetIndirect">
    <linked_class>lnkFunctionalCIToTicket</linked_class>
    <ext_key_to_me>ticket_id</ext_key_to_me>
    <count_min>0</count_min>
    <count_max>0</count_max>
    <ext_key_to_remote>functionalci_id</ext_key_to_remote>
    <with_php_computation>true</with_php_computation>
    <duplicates>
    </duplicates></field>

    I would like to know if it is possible to pre-filter the Functional CIs by Organization when adding a CI directly from the functionalcis_list, in the same way that iTop already does when adding a CI from the Incident edit form.

    For example, I have an Incident belonging to the organization BMZ POLAND.

    1. Adding a CI from the Incident edit form

    When I edit the Incident and add a CI, the CI search form is already filtered by the Incident's Organization:

    Image1.png and Image2.png

    As you can see, the Organization is automatically set to BMZ POLAND.

    1. Adding a CI directly from the functionalcis_list

    However, if I don't edit the Incident and instead click directly on Add CI from the Functional CIs list, the creation form is opened using creation_from_editinplace.

    When I click on the CI search button, the Organization is not pre-filled:

    Image3.png and Image4.png

    Is there a recommended way in iTop 3.2 to pre-filter the Functional CI search by the Organization of the Incident when using creation_from_editinplace?

    Any advice on how to achieve this without modifying the iTop core would be greatly appreciated.

    Thanks!

     
  • Stephen Abello

    Stephen Abello - 2026-08-14

    Hi Samuel,

    I didn't find any documentation/example of this behavior, but as far as I remember:

    There's indeed a difference between adding a CI from Incident edit form, and adding a CI form Incident details.

    When you're on the edit form, it'll call the PrefillCreation with creation_from_editinplace context, and it'll show you the CI directly (displaying the lnkFunctionalCIToTicket objects only in the table after you selected a CI).
    Moreover, when the host object has an org_id, it's often directly passed to the search form.

    When you're on the host object display, if click the (+) button, an edit form of a lnkFunctionalCIToTicket is displayed, and this element in your case doesn't have an org_id so it's not passed to the lnkFunctionalCIToTicket functionalci_id external key search.

    You could add a PrefillSearchForm to lnkFunctionalCIToTicket and prefill the search when the destination class is FunctionalCIby adding a condition on the search's org_id (that'll you get by querying the ticket_id).

    Or another option that may (I'm not 100% sure) work is addind an org_idattribute to lnkFunctionalCIToTicket, making it an external field to ticket_id's org_id. That may also hide some of these elements to the user if you use allowed organizations unfortunately

    Let me know if this helps,
    Stephen

     

Log in to post a comment.