Menu

Select contact from request template field

Alexander
2023-01-10
2023-01-13
  • Alexander

    Alexander - 2023-01-10

    Greetings.
    Please help me with correct oql if it possible!
    I have request template with drop down field where i selecting person from Team
    Is it possible to select person from this field as contact?
    I need this for approval rule..
    I tried this
    SELECT Contact WHERE name LIKE :template->fieldcode
    But getting error

     

    Last edit: Alexander 2023-01-10
  • Hipska

    Hipska - 2023-01-12

    You probably get an error because :template isn't known for approval rule?

    Try the following:

    SELECT Contact AS C
    JOIN TemplateFieldValueLnk AS T ON T.field_target_key = C.id
    WHERE T.field_target_class = C.finalclass AND T.field_code = 'person'
    AND T.obj_class = :this->finalclass AND T.obj_key = :this->id
    
     

    Last edit: Hipska 2023-01-12
    • Alexander

      Alexander - 2023-01-12

      You save my day, thanks a lot it works!
      But can you please explain what is ":this->finalclass" i can't find info about it (finalclass) and for now it is hard to understand how it works

       
      • Hipska

        Hipska - 2023-01-12

        See the datamodel pages in your iTop, finalclass contains the actual child class of your objects. So for tickets this will be UserRequest or Incident for example, and for contacts this will be Person or Team.

         

        Last edit: Hipska 2023-01-12
        • Alexander

          Alexander - 2023-01-12

          Thanks again for detailed explanation, there was 0 result on global search , but i found it now in TemplateFieldValueLnk Atributes

           
  • Pierre Goiffon

    Pierre Goiffon - 2023-01-13

    Hello,

    As a reference : request templates data can be used in queries since the 2.1.0 version of the extension.
    As a reference, there are some elements in the Q&A section of the extension documentation

     

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.