Scrips issue

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Im trying to make a scrips where if there is a string ‘fechar’ in the
subject of the mail, it closes the coresponding ticket.

Here goes:
Description: AutoClose on e-mail reply
Condition: On Create
Action: User Defined
Template: Blank
Stage: TransactionCreate

Custom condition:

Custom action preparation code:
1;

Custom action cleanup code:
my $problem_desc = undef;

my $Transaction = $self->TransactionObj;
my $subject = $Transaction->Attachments->First->GetHeader(‘Subject’);
if ($subject =~ m/fechar/) {
$problem_desc = $2;

$RT::Logger->debug("Usuario aprovou a solucao: $problem_desc");

} else {
return 1;
}

my $TicketsObj = RT::Tickets->new($RT::SystemUser);
$search->LimitStatus(VALUE => ‘new’, OPERATOR => ‘=’, ENTRYAGGREGATOR
=> ‘or’);
$search->LimitStatus(VALUE => ‘open’, OPERATOR => ‘=’);

if ($search->Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search->Next) {

next if $self->TicketObj->Id == $ticket->Id;
$id = $ticket->Id;
last;
}

$id || return 1;
$self->TicketObj->SetStatus( “resolved” );
1;

But it isnt working. Can anybody help me ???

Regards,


[]'s
Luiz Henrique Ozaki luiz@eaprender.com.br
0xC842A83F KEYID

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFCnwG9w2cLyMhCqD8RAvQCAJ9tO1oY7PQ+8FHRKSM9i7019kkH3QCeIz8u
Oh+ReH375WC2NO/HX+LU/6E=
=GF8U
-----END PGP SIGNATURE-----

HI,

I think your problem is your condition. It’s not “On Create” that you
want. As far as I can tell you’re not creating a new ticket. You
probably want “On Correspond” or “On Comment” depending on how you setup
the alias.

Ramon Kagan, GCIA
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby
----------------------------------- ------------------------------------On Thu, 2 Jun 2005, Luiz Henrique Ozaki wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Im trying to make a scrips where if there is a string ‘fechar’ in the
subject of the mail, it closes the coresponding ticket.

Here goes:
Description: AutoClose on e-mail reply
Condition: On Create
Action: User Defined
Template: Blank
Stage: TransactionCreate

Custom condition:

Custom action preparation code:
1;

Custom action cleanup code:
my $problem_desc = undef;

my $Transaction = $self->TransactionObj;
my $subject = $Transaction->Attachments->First->GetHeader(‘Subject’);
if ($subject =~ m/fechar/) {
$problem_desc = $2;

$RT::Logger->debug("Usuario aprovou a solucao: $problem_desc");

} else {
return 1;
}

my $TicketsObj = RT::Tickets->new($RT::SystemUser);
$search->LimitStatus(VALUE => ‘new’, OPERATOR => ‘=’, ENTRYAGGREGATOR
=> ‘or’);
$search->LimitStatus(VALUE => ‘open’, OPERATOR => ‘=’);

if ($search->Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search->Next) {

next if $self->TicketObj->Id == $ticket->Id;
$id = $ticket->Id;
last;
}

$id || return 1;
$self->TicketObj->SetStatus( “resolved” );
1;

But it isnt working. Can anybody help me ???

Regards,


's
Luiz Henrique Ozaki luiz@eaprender.com.br
0xC842A83F KEYID

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFCnwG9w2cLyMhCqD8RAvQCAJ9tO1oY7PQ+8FHRKSM9i7019kkH3QCeIz8u
Oh+ReH375WC2NO/HX+LU/6E=
=GF8U
-----END PGP SIGNATURE-----


The rt-users Archives

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ramon Kagan wrote:

HI,

I think your problem is your condition. It’s not “On Create” that
you want. As far as I can tell you’re not creating a new ticket.
You probably want “On Correspond” or “On Comment” depending on how
you setup the alias.

Ramon Kagan, GCIA York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263 rkagan@yorku.ca


------------------------------------ I have not failed. I have
just I don’t know the secret to success, found 10,000 ways
that don’t work. but the secret to failure is trying to please
everybody. - Thomas Edison - Bill Cosby


I changed it but it didnt work either…

Regards,


's
Luiz Henrique Ozaki luiz@eaprender.com.br
0xC842A83F KEYID

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFCnwVGw2cLyMhCqD8RAryOAKCRCQzrd5F9Sc4PVhq2cKx6jnzsPgCggPyi
QprBFpXU34NFCvP9ysBl9C8=
=rYnz
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I’ve got it !! Enanbling the debug ive got the error.

Here goes:
Description: AutoClose on e-mail reply with a determinated string in
the Subject
Condition: On Create
Action: User Defined
Template: Blank
Stage: TransactionCreate

Custom condition:

Custom action preparation code:
1;

Custom action cleanup code:

my $problem_desc = undef;

my $Transaction = $self->TransactionObj;
my $subject = $Transaction->Attachments->First->GetHeader(‘Subject’);
if ($subject =~ m/fechar/) {
$problem_desc = $2;

$RT::Logger->debug("Usuario aprovou a solucao: $problem_desc");

} else {
return 1;
}

my $search = RT::Tickets->new($RT::SystemUser);
$search->LimitQueue(VALUE => ‘General’);
$search->LimitStatus(VALUE => ‘new’, OPERATOR => ‘=’, ENTRYAGGREGATOR
=> ‘or’);
$search->LimitStatus(VALUE => ‘open’, OPERATOR => ‘=’);

if ($search->Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search->Next) {

next if $self->TicketObj->Id == $ticket->Id;
$id = $ticket->Id;
last;
}

$id || return 1;
$self->TicketObj->SetStatus( “resolved” );
1;

Now I have another problem. How Can I make a unique mail to correspond
to all the queues ??


[]'s
Luiz Henrique Ozaki luiz@eaprender.com.br
0xC842A83F KEYID

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFCn0Lqw2cLyMhCqD8RAiH7AKCc5tByWsgIlh1hSpu99v2JTlw4PQCgyJAY
7APuIJy6ThLdsDBE5+/GEi8=
=YqdM
-----END PGP SIGNATURE-----