Using 3.6.4, I’m trying to create child tickets if the value of a CF called
“Ticket Type” is set to “Provisioning”. However, I can’t seem to work out the
logic for the Custom condition. This is what I have:
With the Custom action preparation code being:
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Ticket
Type’) =~ /Provisioning/i;
The Custom action cleanup code is empty.
I’ve changed it to include the FirstCustomFieldValue check as part of the
condition and the prep code set to “return 1;” but that didn’t help. The only
time I can get the child tickets to spawn is if I add "|| $self->TickeObj->Type
eq “Create” "
I’m guessing I’ve go the logic wrong. Can someone help me out with this?
Disclaimer: I use 3.6.3, so things might have changed with 3.6.4
Since you are using Custom action prep code, I assume your Action is set to
User Defined. If this is the case, your Prep action won’t trigger anything
because there’s nothing in your Cleanup code.
If your Action is set to something other than User Defined, the Custom prep
and cleanup sections are ignored.
Gene
At 10:52 AM 9/24/2007, Mathew Snyder wrote:
Using 3.6.4, I’m trying to create child tickets if the value of a CF called
“Ticket Type” is set to “Provisioning”. However, I can’t seem to work out the
logic for the Custom condition. This is what I have:
With the Custom action preparation code being:
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Ticket
Type’) =~ /Provisioning/i;
The Custom action cleanup code is empty.
I’ve changed it to include the FirstCustomFieldValue check as part of the
condition and the prep code set to “return 1;” but that didn’t help. The only
time I can get the child tickets to spawn is if I add "||
$self->TickeObj->Type
eq “Create” "
I’m guessing I’ve go the logic wrong. Can someone help me out with this?
I’ve figured out the problem. The Custom condition that checks if a transaction
is for CustomFields, is on the one CF and that the value is being set to
Provisioning doesn’t run during a ticket Create action. If I set the value of
that CF to Provisioning after the ticket has been created, the child tickets
I’m trying to spawn are created. I’m wondering if using TransactionBatch will
fix this.
I’ve figured out the problem. The Custom condition that checks if a
transaction
is for CustomFields, is on the one CF and that the value is being set to
Provisioning doesn’t run during a ticket Create action. If I set the value of
that CF to Provisioning after the ticket has been created, the child tickets
I’m trying to spawn are created. I’m wondering if using TransactionBatch will
fix this.
Can you do something like this in the condition:
IF transaction type is “Create”
OR (transaction type is “CustomField” and transaction field id = 5)
return 1
ELSE
return 0
or maybe you could dispense with the custom action part and have this
in the condition:
IF ( transaction type is “Create” and Ticket Type CF = ‘Provisioning’)
OR (transaction type is “CustomField” and transaction field id = 5
and trans new value = ‘Provisioning’)
return 1
ELSE
return 0
I’ve figured out the problem. The Custom condition that checks if a
transaction
is for CustomFields, is on the one CF and that the value is being set to
Provisioning doesn’t run during a ticket Create action. If I set the
value of
that CF to Provisioning after the ticket has been created, the child
tickets
I’m trying to spawn are created. I’m wondering if using
TransactionBatch will
fix this.
Can you do something like this in the condition:
IF transaction type is “Create”
OR (transaction type is “CustomField” and transaction field id = 5)
return 1
ELSE
return 0
or maybe you could dispense with the custom action part and have this in
the condition:
IF ( transaction type is “Create” and Ticket Type CF = ‘Provisioning’)
OR (transaction type is “CustomField” and transaction field id = 5 and
trans new value = ‘Provisioning’)
return 1
ELSE
return 0
Steve
Heh…I was just in the process of writing an email indicating that I need to
work out just that logic when I got your last email. I think that’s when
TransactionBatch would be useful. What would the “Ticket Type CF =
‘Provisioning’” line look like? Would I still use
“$self-TicketObj-FirstCustomFieldValue(‘Ticket Type’) eq ‘Provisioning’”?
I’ve figured out the problem. The Custom condition that checks if a
transaction
is for CustomFields, is on the one CF and that the value is being set to
Provisioning doesn’t run during a ticket Create action. If I set the
value of
that CF to Provisioning after the ticket has been created, the child
tickets
I’m trying to spawn are created. I’m wondering if using
TransactionBatch will
fix this.
Can you do something like this in the condition:
IF transaction type is “Create”
OR (transaction type is “CustomField” and transaction field id = 5)
return 1
ELSE
return 0
or maybe you could dispense with the custom action part and have this in
the condition:
IF ( transaction type is “Create” and Ticket Type CF = ‘Provisioning’)
OR (transaction type is “CustomField” and transaction field id = 5 and
trans new value = ‘Provisioning’)
return 1
ELSE
return 0
Steve
I’ve pretty much answered my own question. However, it isn’t able to create the
child tickets giving the following information:
[Mon Sep 24 19:41:22 2007] [debug]: ARRAY(0x82b90118) not a recognised queue
object. (/usr/local/rt3/lib/RT/Ticket_Overlay.pm:403)
[Mon Sep 24 19:41:22 2007] [debug]: RT::Ticket=HASH(0x82b7f428) No queue given
for ticket creation. (/usr/local/rt3/lib/RT/Ticket_Overlay.pm:408)
[Mon Sep 24 19:41:22 2007] [error]: Couldn’t create related ticket create-Child
for 87375 Could not create ticket. Queue not set
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:619)
[Mon Sep 24 19:41:22 2007] [warning]: Use of uninitialized value in
concatenation (.) or string at /usr/local/rt3/lib/RT/Action/CreateTickets.pm
line 1416. (/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1416)
[Mon Sep 24 19:41:22 2007] [debug]: Handling links for
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1416)
[Mon Sep 24 19:41:22 2007] [debug]: Building Parents link for 87375
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1442)
[Mon Sep 24 19:41:22 2007] [crit]: HasRight called with no valid object
(/usr/local/rt3/lib/RT/Principal_Overlay.pm:323)
[Mon Sep 24 19:41:22 2007] [warning]: AddLink thru 87375 failed: Permission
Denied (/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1451)
[Mon Sep 24 19:41:22 2007] [debug]: Building Parents link for 87375
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1442)
[Mon Sep 24 19:41:22 2007] [crit]: HasRight called with no valid object
(/usr/local/rt3/lib/RT/Principal_Overlay.pm:323)
[Mon Sep 24 19:41:22 2007] [warning]: AddLink thru 87375 failed: Permission
Denied (/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1451)
[Mon Sep 24 19:41:22 2007] [warning]: Use of uninitialized value in
concatenation (.) or string at /usr/local/rt3/lib/RT/Action/CreateTickets.pm
line 1416. (/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1416)
[Mon Sep 24 19:41:22 2007] [debug]: Handling links for
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1416)
[Mon Sep 24 19:41:22 2007] [debug]: Building Parents link for 87375
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1442)
[Mon Sep 24 19:41:22 2007] [crit]: HasRight called with no valid object
(/usr/local/rt3/lib/RT/Principal_Overlay.pm:323)
[Mon Sep 24 19:41:22 2007] [warning]: AddLink thru 87375 failed: Permission
Denied (/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1451)
[Mon Sep 24 19:41:22 2007] [debug]: Building Parents link for 87375
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1442)
[Mon Sep 24 19:41:22 2007] [crit]: HasRight called with no valid object
(/usr/local/rt3/lib/RT/Principal_Overlay.pm:323)
[Mon Sep 24 19:41:22 2007] [warning]: AddLink thru 87375 failed: Permission
Denied (/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1451)
[Mon Sep 24 19:41:22 2007] [warning]: Use of uninitialized value in
concatenation (.) or string at /usr/local/rt3/lib/RT/Action/CreateTickets.pm
line 1463. (/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1463)
[Mon Sep 24 19:41:22 2007] [debug]: Handling postponed actions for
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1463)
[Mon Sep 24 19:41:22 2007] [warning]: Use of uninitialized value in
concatenation (.) or string at /usr/local/rt3/lib/RT/Action/CreateTickets.pm
line 1463. (/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1463)
[Mon Sep 24 19:41:22 2007] [debug]: Handling postponed actions for
(/usr/local/rt3/lib/RT/Action/CreateTickets.pm:1463)
Not sure what the problem is considering I’ve been able to create child tickets
when the condition was set the previous way. That tells me it isn’t really a
permissions problem that I can see.