Menu

Adding new field from User to the criterion search list on ticket.

Ichigo
2021-04-22
2021-05-04
  • Ichigo

    Ichigo - 2021-04-22

    Hello,

    I have created an extension that adds a new field to the User (Person), now I want to filter the tickets (incidents) by my new field, adding it to the "add new criteria" list on the Search for Incident Objects View, however I can't find where I should add my new search criteria.

    Could you guide me please?

    Thanks

     

    Last edit: Ichigo 2021-04-27
  • Vincent @ Combodo

    There is no relation between a User and a Ticket, so I assume that when you write User, you mean either the requestor of the Ticket (caller_id) or the Agent (agent_id) which both are Person object.
    So assuming you have added a field on Person to specify if that person is a VIP (a top manager for eg), and then want to search for Ticket requested by a VIP person, then:

    • Just add an ExternalField attribute on Ticket based on caller_id returning the VIP field of the Person.
    • This attribute ExternalField will be available in the search criteria of the Ticket
     
  • Ichigo

    Ichigo - 2021-04-23

    Hi Vincent,

    Thanks for your response, i added this code to my datamodel xml on my extension.
    ctm_roles is the field on the Person table. ( attribute type: AttributeEnumSet)

    <class id="Ticket">
                <fields>
                    <field id="caller_ctm_roles" xsi:type="AttributeExternalField"  _delta="define">
                        <extkey_attcode>caller_id</extkey_attcode>
                        <target_attcode>ctm_roles</target_attcode>
                    </field>
                </fields>
            </class>
    

    In the view_Ticket from the database i can see the field caller_ctm_roles with a value ( eg. |Admin|VIP| ) , but it does not appear in the search criteria list of the Ticket.
    Did I need to modify something else?
    Thank you so much.

     
    • Jeffrey Bostoen

      Jeffrey Bostoen - 2021-04-25

      Did you also add it to the presentation node?

       
  • Ichigo

    Ichigo - 2021-04-26

    Hi Jeffrey,

    Yes, I have also tried, but without success.
    I added them in both search and default_search, but it still doesn't show up.

     <presentation>
                    <default_search _delta="redefine">
                        <items>
                            <item id="ref">
                                <rank>10</rank>
                            </item>
                            <item id="title">
                                <rank>20</rank>
                            </item>
                            <item id="caller_id">
                                <rank>30</rank>
                            </item>
                            <item id="org_id">
                                <rank>35</rank>
                            </item>
                            <item id="caller_ctm_roles">
                                <rank>45</rank>
                            </item>
                        </items>
                    </default_search>
                    <search _delta="redefine">
                        <items>
                            <item id="ref">
                                <rank>10</rank>
                            </item>
                            <item id="title">
                                <rank>20</rank>
                            </item>
                            <item id="description">
                                <rank>30</rank>
                            </item>
                            <item id="operational_status">
                                <rank>35</rank>
                            </item>
                            <item id="start_date">
                                <rank>40</rank>
                            </item>
                            <item id="end_date">
                                <rank>50</rank>
                            </item>
                            <item id="last_update">
                                <rank>60</rank>
                            </item>
                            <item id="close_date">
                                <rank>70</rank>
                            </item>
                            <item id="caller_ctm_roles">
                                <rank>80</rank>
                            </item>
                        </items>
                    </search>
    
     
  • Ichigo

    Ichigo - 2021-04-27

    Hi,

    This is my new attempt, the entire datamodel from my extension.

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
        <classes>
            <class id="Person">
                <fields>
                    <field id="ctm_roles" xsi:type="AttributeEnumSet" _delta="define">
                        <values>
                            <value>Student</value>
                            <value>Teacher</value>
                        </values>
                        <sql>ctm_roles</sql>
                        <is_null_allowed>false</is_null_allowed>
                    </field>
                </fields>
                <presentation>
                    <details _delta="redefine">
                        <items>
                            <item id="team_list">
                                <rank>10</rank>
                            </item>
                            <item id="tickets_list">
                                <rank>20</rank>
                            </item>
                            <item id="cis_list">
                                <rank>30</rank>
                            </item>
                            <item id="col:col1">
                                <rank>40</rank>
                                <items>
                                    <item id="fieldset:Person:info">
                                        <rank>10</rank>
                                        <items>
                                            <item id="name">
                                                <rank>10</rank>
                                            </item>
                                            <item id="first_name">
                                                <rank>20</rank>
                                            </item>
                                            <item id="org_id">
                                                <rank>30</rank>
                                            </item>
                                            <item id="status">
                                                <rank>40</rank>
                                            </item>
                                            <item id="location_id">
                                                <rank>50</rank>
                                            </item>
                                            <item id="function">
                                                <rank>60</rank>
                                            </item>
                                            <item id="manager_id">
                                                <rank>70</rank>
                                            </item>
                                            <item id="employee_number">
                                                <rank>80</rank>
                                            </item>
                                            <item id="ctm_roles">
                                                <rank>90</rank>
                                            </item>
                                        </items>
                                    </item>
                                </items>
                            </item>
                            <item id="col:col2">
                                <rank>50</rank>
                                <items>
                                    <item id="fieldset:Person:personal_info">
                                        <rank>5</rank>
                                        <items>
                                            <item id="picture">
                                                <rank>10</rank>
                                            </item>
                                        </items>
                                    </item>
                                    <item id="fieldset:Person:notifiy">
                                        <rank>10</rank>
                                        <items>
                                            <item id="email">
                                                <rank>10</rank>
                                            </item>
                                            <item id="notify">
                                                <rank>20</rank>
                                            </item>
                                            <item id="phone">
                                                <rank>30</rank>
                                            </item>
                                            <item id="mobile_phone">
                                                <rank>40</rank>
                                            </item>
                                        </items>
                                    </item>
                                </items>
                            </item>
                        </items>
                    </details>
                </presentation>
            </class>
    
            <class id="Ticket">
                <fields>
                    <field id="caller_ctm_roles" xsi:type="AttributeExternalField" _delta="define">
                        <extkey_attcode>caller_id</extkey_attcode>
                        <target_attcode>ctm_roles</target_attcode>
                    </field>
                </fields>
                <presentation>
                    <default_search>
                        <items>
                            <item id="caller_ctm_roles" _delta="define">
                                <rank>40</rank>
                            </item>
                        </items>
                    </default_search>
                    <search>
                        <items>
                            <item id="caller_ctm_roles" _delta="define">
                                <rank>80</rank>
                            </item>
                        </items>
                    </search>
                </presentation>
            </class>
    
            <class id="Incident">
                <presentation>
                    <search>
                        <items>
                            <item id="caller_ctm_roles" _delta="define">
                                <rank>240</rank>
                            </item>
                        </items>
                    </search>
                </presentation>
            </class>
    
        </classes>
    </itop_design>
    

    dependences for the extension :

    itop-config-mgmt/2.7.4
    itop-service-mgmt-provider/2.7.4
    

    But still dont works

     
    • Ichigo

      Ichigo - 2021-05-04

      @cisou @jbostoen Please can you help me ?

       

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.