Flylib.com

Books Software

 
 
 

4.2. Creating a Ticket

 < Day Day Up > 

4.2. Creating a Ticket

In order to create a ticket with rt , use the create action. This action creates users and queues in addition to new tickets, so create requires an object type:

$

rt create -t ticket


When this command is issued, your editor will open up with some basic data and fields for you to fill out:

# Required: Queue, Requestor, Subject

     

    id: ticket/new

    Queue: General

    Requestor: jdoe

    Subject:

    Cc:

    AdminCc:

    Owner:

    Status: new

    Priority: 50

    InitialPriority: 50

    FinalPriority: 0

    TimeEstimated: 0

    Starts: 2004-09-21 01:05:11

    Due: 2004-09-21 01:05:11

    Text:

Once you fill in the required fieldsqueue, requestor, and subjectand write the file to submit the data to the server, you will get a message indicating success:

# Ticket 23 created.

If any of the required fields are not present, rt will reopen your editor with the data and a message indicating which fields were missing.

You also can create a ticket by passing values for the fields directly on the command line. At a minimum, you need a valid subject line and a queue:

$

rt create -t ticket set subject="urgent contact request" set queue=general

# Ticket 45 created.

Now use the show action to check that the ticket was correctly created.

$

rt show ticket/45 -f id,subject,queue

id: ticket/45

    Subject: urgent contact request

    Queue: General

You also can create users with the same create action, setting the minimal required name to avoid the interactive form.

$

rt create -t user set name=bigboote

# User 66 created.

     

    $ rt show user/66

    id: user/66

    Name: bigboote

    Password: ********

    EmailAddress:

 < Day Day Up > 
 < Day Day Up > 

4.3. Finding a Ticket

The show action displays a ticket and its metadata, history, and attachments:

$

rt show ticket/3

id: ticket/3

    Queue: General

    Owner: darren

    Creator: root

    Subject: Bring more coffee rolls!

    Status: open

    Priority: 90

    InitialPriority: 0

    FinalPriority: 0

    Requestors:

    Cc:

    AdminCc:

    Created: Mon May 03 21:18:30 2004

    Starts: Mon May 03 21:17:43 2004

    Started: Mon May 03 22:20:23 2004

    Due: Mon May 03 21:17:43 2004

    Resolved: Not set

    Told: Not set

    TimeEstimated: 0

    TimeWorked: 0

    TimeLeft: 0

As you can see, show displays a lot of information by default. To limit the amount of detail returned, pass the -f option to specify the fields you want to see. The field names correspond to what show displays, except they are not case-sensitive. The following example limits the display to ticket ID, queue name , subject, status, and priority:

$

rt show ticket/3 -f id,queue,subject,status,priority

id: ticket/3

    Queue: General

    Subject: Bring more coffee rolls!

    Status: open

    Priority: 90

By default, show shows the object's metadata. However, there are other object attributes you might want to see, like a ticket's history or attachments. These attributes are addressed using the object specification syntax. To access the history attribute of ticket 9, use ticket/9/history .

$

rt show ticket/9/history

# 6/6 (/total)

     

    63: Ticket created by jdoe

    64: Cc root@localhost added by jdoe

    72: Cc root@eruditorum.org added by jdoe

    73: Cc root@localhost removed by root

    74: Priority changed from 0 to 99 by jdoe

    75: Status changed from new to open by jdoe

You also can display all of the attachments for a ticket with the attachments attribute:

$

rt show ticket/9/attachments

 

    Attachments: 7:  (multipart/mixed / 0b), 8:  (text/plain / 29b),

                 9:  (multipart/mixed / 0b), 10:  (text/plain / 0b),

                 11: output.txt (text/plain / 164b),

                 12:  (text/plain / 622b)

To view the plain-text content of one of the attachments, use the content attribute together with the attachments attribute:

$

rt show ticket/9/attachments/11/content

 

    This is the output I get when I try the first solution:

    ...

Here's a command to look at the information that makes up an RT user , reducing the output by specifying certain fields only:

$

rt show -t user -f id,name,emailaddress,comments root

 

Referring to Objects and Attributes

Many rt operations act on an object, which is designated by a specification . Every object in RT has a type ( ticket , queue , or user , for example) and a numeric ID. Some types of objects also can be identified by name (like users and queues). Furthermore, objects may have named attributes, such as history or attachments . An object specification is like a path in a virtual filesystem, with object types as top-level directories, object IDs as subdirectories, and named attributes as further subdirectories. For example, you reference RT's root user as:

user/root

A comma-separated list of names, numeric IDs, or numeric ranges can specify more than one object of the same type. Note that the list must be a single argument (i.e., no spaces). For example, to reference the root and aml users by name, and several other users by their numeric ID, you could write:

user/root,1-3,5,7-10,aml

The same list also can be written as:

user/aml,root,1,2,3,5,7,8,9,10

The same notation extends to attributes.


id: user/12

    Name: root

    EmailAddress: root@localhost

    Comments: SuperUser

When looking at several tickets at once, note that you can specify multiple IDs separated by commas, and a range of IDs defined with a dash between the minimum and maximum ID, as in the following example:

$

rt show ticket/1,5-8,42 -f id,subject,status

 

    id: ticket/1

    Subject: a new ticket

    Status: new

     

    --

     

    id: ticket/5

    Subject: a new ticket

    Status: new

     

    --

     

    id: ticket/6

    Subject: a new ticket

    Status: new

     

    ...

In addition to the type/id form, you also can specify multiple object IDs at the end of the command, separated by either spaces or commas:

$

rt show -t ticket -f id,subject,status 1 5-8 42

 

    id: ticket/1

    Subject: a new ticket

    Status: new

     

    --

     

    id: ticket/5

    Subject: a new ticket

    Status: new

     

    --

     

    id: ticket/6

    Subject: a new ticket

    Status: new

     

    --

     

    id: ticket/7

    Subject: a new ticket

    Status: new

     

    --

     

    id: ticket/8

    Subject: a new ticket

    Status: new

     

    --

     

    id: ticket/42

    Subject: a new ticket

    Status: new

 < Day Day Up >