Scrip creating multiple (5?) approvals

Hi folks,

I have a template to create an approval ticket in rt 3.8.2:

===Create-Ticket: Change Request Approval
Refers-To: TOP
Queue: ___Approvals
Requestors: {$Tickets{TOP}->Requestors}
Depended-On-By: TOP
Type: approval
Content-Type: text/plain
Due: {time + 86400}
Content: ...
ENDOFCONTENT

I have a scrip to trigger said approval creation:

Condition: User Defined
my $ticket= $self->TicketObj;
if ( $ticket->FirstCustomFieldValue(‘ticketType’) =~ /change request/i ) {
return 1;
} else {
return 0;
}

Custom action preparation code:
return 1;

Custom action cleanup code:
return 1;

I create a ticket of type ‘change request’ and recieve 5 identical approvals
for the originating ticket. Anyone have any bright suggestions as to why…?

Richard Foley
Ciao - shorter than aufwiedersehen

I believe I have 5 Custom Fields enabled and I wonder if this might have
something to do with the 5 created approvals…?

Richard Foley
Ciao - shorter than aufwiedersehen

Hi folks,

I have a template to create an approval ticket in rt 3.8.2:

===Create-Ticket: Change Request Approval
Subject: CR Approval for: {$Tickets{TOP}->Id} - {$Tickets{TOP}->Subject}
Refers-To: TOP
Queue: ___Approvals
Requestors: {$Tickets{TOP}->Requestors}
Depended-On-By: TOP
Type: approval
Content-Type: text/plain
Due: {time + 86400}
Content: …
ENDOFCONTENT

I have a scrip to trigger said approval creation:

Condition: User Defined
my $ticket= $self->TicketObj;
if ( $ticket->FirstCustomFieldValue(‘ticketType’) =~ /change request/i ) {
return 1;
} else {
return 0;
}

Custom action preparation code:
return 1;

Custom action cleanup code:
return 1;

I create a ticket of type ‘change request’ and recieve 5 identical approvals
for the originating ticket. Anyone have any bright suggestions as to
why…?

That looks to me that you’re going to execute that approval script for
every transaction that occurs in the ticket.

Test for

lc($self->TransactionObj->Type) eq “create”

to only fire the event when the ticket is created.

Condition: User Defined
my $ticket= $self->TicketObj;
if ( $ticket->FirstCustomFieldValue(‘ticketType’) =~ /change
request/i ) {
return 1;
} else {
return 0;
}

Custom action preparation code:
return 1;

Custom action cleanup code:
return 1;

I create a ticket of type ‘change request’ and recieve 5 identical
approvals
for the originating ticket. Anyone have any bright suggestions as to
why…?

Jon Baker
Information Technology
Willie George Ministries
1003 N 129th E Ave
Tulsa OK 74116
(918) 234-5656

Hi Jon,

Thanks very much for that tip.

I believe I’d tried various variations of “On Create”, “User Defined”, “Create
Tickets”, etc. etc. before deciding that this was at least somewhere close to
what I’d intended. I think I’m missing something about the context.

Thanks again, and I’ll take a proper look once I get back on the system
shortly.

Richard Foley
Ciao - shorter than aufwiedersehen

http://www.rfi.net/On Friday 27 March 2009 19:53:25 Jon Baker wrote:

That looks to me that you’re going to execute that approval script for
every transaction that occurs in the ticket.

Test for

lc($self->TransactionObj->Type) eq “create”

to only fire the event when the ticket is created.

Condition: User Defined
my $ticket= $self->TicketObj;
if ( $ticket->FirstCustomFieldValue(‘ticketType’) =~ /change
request/i ) {
return 1;
} else {
return 0;
}

Custom action preparation code:
return 1;

Custom action cleanup code:
return 1;

I create a ticket of type ‘change request’ and recieve 5 identical
approvals
for the originating ticket. Anyone have any bright suggestions as to
why…?


Jon Baker
Information Technology
Willie George Ministries
1003 N 129th E Ave
Tulsa OK 74116
(918) 234-5656

Bingo - thanks Jon, that did it!

I notice the Transaction description in the glossary is not so helpful:

http://wiki.bestpractical.com/view/RTGlossary

"transaction (definition needed)"

Description anyone ?-)

Richard Foley
Ciao - shorter than aufwiedersehen

http://www.rfi.net/On Friday 27 March 2009 19:53:25 Jon Baker wrote:

That looks to me that you’re going to execute that approval script for
every transaction that occurs in the ticket.

Test for

lc($self->TransactionObj->Type) eq “create”

to only fire the event when the ticket is created.

Condition: User Defined
my $ticket= $self->TicketObj;
if ( $ticket->FirstCustomFieldValue(‘ticketType’) =~ /change
request/i ) {
return 1;
} else {
return 0;
}

Custom action preparation code:
return 1;

Custom action cleanup code:
return 1;

I create a ticket of type ‘change request’ and recieve 5 identical
approvals
for the originating ticket. Anyone have any bright suggestions as to
why…?


Jon Baker
Information Technology
Willie George Ministries
1003 N 129th E Ave
Tulsa OK 74116
(918) 234-5656