[rt-users] Offline Tool + Custom Fields

Christopher Snell chris.snell at gmail.com
Wed Aug 10 15:53:16 EDT 2005


On 8/10/05, Rodolfo de Moraes Reis <rmreis at cpqd.com.br> wrote:

> Is there a way to create ticket's, with custom fields, through Offline Tool?! I tried to use like
> CustomField.{Name} but it didn't work!!

Here you go.  Hopefully this will improve my karma and someone will
help me with a solution to my transactional custom fields + scrip
problem.

BTW, this is in the wiki.

# Create Ticket
my $Ticket=new RT::Ticket($RT::SystemUser);

# Create the ticket
my ($ticket, $trans, $msg) = $Ticket->Create(Queue => 'helpdesk',
                                             Owner => 'chris',
                                           Subject => $ticket_subject,
                                            Status => 'new',
                                         Requestor => [
'requestor at company.com' ],
                                           AdminCc => [ 'admin at company.com' ],
                                          Priority => 20,
                                     FinalPriority => 60,
                        );

# Add the customer's contact details to the ticket in the form of a Comment
$Ticket->Comment( Content => $contact_details );

# Load custom field
my $CustomField  = RT::CustomField->new($RT::SystemUser);
$CustomField->LoadByNameAndQueue(Queue => $Ticket->Queue,  Name =>
'somecustomfield');

# Add the primary key from Helpdesk::DB::Incidents to the ticket
$Ticket->AddCustomFieldValue( Field => $CustomField->id, Value => $somevalue );


HTH,

Chris



More information about the rt-users mailing list