How do I just get tickets that are master in ticketobject->TicketGet()

Moderator: crythias

Locked
OTRSRDNewbie
Znuny newbie
Posts: 69
Joined: 29 Apr 2016, 10:23
Znuny Version: 3.2, 5
Real Name: Dennis Cua
Company: N/A

How do I just get tickets that are master in ticketobject->TicketGet()

Post by OTRSRDNewbie »

How do I just get tickets that are master in ticketobject->TicketGet() or in a database query how do I know if the ticket is a master ticket, regular ticket or slave ticket. I looked up the TicketGet() and looked up the ticket table and other tables. I am not sure if I missed it but I didn't seems to see how to determine if its a master ticket or regular ticket or slave ticket.

I'm experimenting with static stats. A few examples of static stats, how to just get master tickets will be helpful
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: How do I just get tickets that are master in ticketobject->TicketGet()

Post by RStraub »

Whether its a master or slave is saved as normal dynamic field. A DB query could look like this:

Code: Select all

select object_id from dynamic_field_value where field_id in (select id from dynamic_field where name = "MasterSlave") and value_text = "Master";
For the TicketGet, first run a TicketSearch, like so:

Code: Select all

my @TicketIDs = $TicketObject->TicketSearch(
        Result => 'ARRAY',
        DynamicField_MasterSlave => {
            Equals            => 'Master',	  # To find all master tickets
            Like              => 'SlaveOf:*',          # To get all slaves, choose either
        }

        # user search (UserID is required)
        UserID     => 1,

    );
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Locked