Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Users

Creating a ticket with RT::Ticket->Create

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


ptomblin at xcski

Apr 24, 2012, 11:42 AM

Post #1 of 3 (465 views)
Permalink
Creating a ticket with RT::Ticket->Create

When I'm creating a ticket with RT::Ticket api, how do I set the text that
goes into the box that says ""Describe the Issue below"? It appears to end
up as an attachment, and I can retrieve it from an existing ticket using

my $attachments = RT::Attachments->new(RT->SystemUser);
$attachments->LimitByTicket($tik->id);

foreach my $type (qw(Create Comment Correspond)) {
$attachments->Limit( ALIAS => $attachments->TransactionAlias,
FIELD => 'Type',
OPERATOR => '=',
VALUE => $type,
ENTRYAGGREGATOR => 'OR',
CASESENSITIVE => 1
);
}

I tried adding it with $ticket->_CreateNote, but then I end up with two
"The RT System itself - Ticket created" records.

--
http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin


ruslan.zakirov at gmail

Apr 24, 2012, 10:45 PM

Post #2 of 3 (432 views)
Permalink
Re: Creating a ticket with RT::Ticket->Create [In reply to]

Create takes content as MIME::Entity object. Steal examples from Comment
and/or MakeMimeEntity functions.

Ruslan from phone.
24.04.2012 22:42 пользователь "Paul Tomblin" <ptomblin [at] xcski> написал:

> When I'm creating a ticket with RT::Ticket api, how do I set the text that
> goes into the box that says ""Describe the Issue below"? It appears to end
> up as an attachment, and I can retrieve it from an existing ticket using
>
> my $attachments = RT::Attachments->new(RT->SystemUser);
> $attachments->LimitByTicket($tik->id);
>
> foreach my $type (qw(Create Comment Correspond)) {
> $attachments->Limit( ALIAS => $attachments->TransactionAlias,
> FIELD => 'Type',
> OPERATOR => '=',
> VALUE => $type,
> ENTRYAGGREGATOR => 'OR',
> CASESENSITIVE => 1
> );
> }
>
> I tried adding it with $ticket->_CreateNote, but then I end up with two
> "The RT System itself - Ticket created" records.
>
> --
> http://www.linkedin.com/in/paultomblin
> http://careers.stackoverflow.com/ptomblin
>
>


ptomblin at xcski

Apr 25, 2012, 3:46 AM

Post #3 of 3 (429 views)
Permalink
Re: Creating a ticket with RT::Ticket->Create [In reply to]

Thanks. Found the code in RT/Interface/Web and adapted it like so:

# Get the Master Ticket's creation text
my $attachments = RT::Attachments->new(RT->SystemUser);
$attachments->LimitByTicket($ticket->id);
$attachments->Limit( ALIAS => $attachments->TransactionAlias,
FIELD => 'Type',
OPERATOR => '=',
VALUE => 'Create',
ENTRYAGGREGATOR => 'OR',
CASESENSITIVE => 1
);

my $mimeObj;

while (my $att = $attachments->Next) {
$mimeObj = MIME::Entity->build(
Type => 'multipart/mixed',
'Message-Id' => RT::Interface::Email::GenMessageId,
Subject => $att->Subject
);
$mimeObj->attach(
Type => $att->ContentType,
Charset => 'UTF-8',
Data => $att->Content);
$mimeObj->make_singlepart;
}

Thanks.

On Wed, Apr 25, 2012 at 1:45 AM, Ruslan Zakirov <ruslan.zakirov [at] gmail>wrote:

> Create takes content as MIME::Entity object. Steal examples from Comment
> and/or MakeMimeEntity functions.
>
> Ruslan from phone.
> 24.04.2012 22:42 "Paul Tomblin" <ptomblin [at] xcski> :
>
> When I'm creating a ticket with RT::Ticket api, how do I set the text that
>> goes into the box that says ""Describe the Issue below"? It appears to end
>> up as an attachment, and I can retrieve it from an existing ticket using
>>
>> my $attachments = RT::Attachments->new(RT->SystemUser);
>> $attachments->LimitByTicket($tik->id);
>>
>> foreach my $type (qw(Create Comment Correspond)) {
>> $attachments->Limit( ALIAS => $attachments->TransactionAlias,
>> FIELD => 'Type',
>> OPERATOR => '=',
>> VALUE => $type,
>> ENTRYAGGREGATOR => 'OR',
>> CASESENSITIVE => 1
>> );
>> }
>>
>> I tried adding it with $ticket->_CreateNote, but then I end up with two
>> "The RT System itself - Ticket created" records.
>>
>> --
>> http://www.linkedin.com/in/paultomblin
>> http://careers.stackoverflow.com/ptomblin
>>
>>


--
http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin

Request Tracker users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.