ExtractCustomFields for Ticket values

I’m working on switching from individual per Queue custom scrips in Perl to
using ExtractCustomFields for populating ticket data on creation via
incoming email. So far I’ve gotten the basics working, but I’m running
into a brick wall changing the ticket owner.

What we had as a scrip, pruned down to just setting the owner:

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
my $Attachment = $Transaction->Attachments;
my $AttFirst = $Attachment->First;

my $NewRTOwner = $AttFirst->GetHeader(‘X-NEW-RT-OWNER’);

$Ticket->SetOwner($NewRTOwner);

With ExtractCustomFields I’ve setup the standard scrip with the following
template:

|X-NEW-RT-OWNER|.*|$RT::Ticket->SetOwner($value)|

With debug logging lit, the post command is failing saying method SetOwner
can’t be called on an undefined value. I can see that $value is getting
correct set from the debug leading up to that failure, so I suspect this is
a scope error on my part?

Any guidance would be greatly appreciated.

Josh C

Solved my own issue, I was mis-reading the error. Final solution for the
postcmd: my $ticket = $self->TicketObj; $ticket->SetOwner($value)|

Josh COn Tue, Sep 1, 2015 at 2:46 PM, Josh Coombs jcoombs@staff.gwi.net wrote:

I’m working on switching from individual per Queue custom scrips in Perl
to using ExtractCustomFields for populating ticket data on creation via
incoming email. So far I’ve gotten the basics working, but I’m running
into a brick wall changing the ticket owner.

What we had as a scrip, pruned down to just setting the owner:

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
my $Attachment = $Transaction->Attachments;
my $AttFirst = $Attachment->First;

my $NewRTOwner = $AttFirst->GetHeader(‘X-NEW-RT-OWNER’);

$Ticket->SetOwner($NewRTOwner);

With ExtractCustomFields I’ve setup the standard scrip with the following
template:

|X-NEW-RT-OWNER|.*|$RT::Ticket->SetOwner($value)|

With debug logging lit, the post command is failing saying method SetOwner
can’t be called on an undefined value. I can see that $value is getting
correct set from the debug leading up to that failure, so I suspect this is
a scope error on my part?

Any guidance would be greatly appreciated.

Josh C

Just an FYI, it might simplify things in the future if you access things as directly as possible. Some prefer to do this, some don’t I guess.

For Example - instead of:
my $ticket = $self->TicketObj; $ticket->SetOwner($value)

You might do:
$self->TicketObj->SetOwner($value)

Or even:
$self->TicketObj->SetOwner(
$self->TransactionObj->Attachments->First->GetHeader(‘X-NEW-RT-OWNER’)
);On Sep 1, 2015, at 1:17 PM, Josh Coombs <jcoombs@staff.gwi.netmailto:jcoombs@staff.gwi.net> wrote:

Solved my own issue, I was mis-reading the error. Final solution for the postcmd: my $ticket = $self->TicketObj; $ticket->SetOwner($value)|

Josh C

On Tue, Sep 1, 2015 at 2:46 PM, Josh Coombs <jcoombs@staff.gwi.netmailto:jcoombs@staff.gwi.net> wrote:
I’m working on switching from individual per Queue custom scrips in Perl to using ExtractCustomFields for populating ticket data on creation via incoming email. So far I’ve gotten the basics working, but I’m running into a brick wall changing the ticket owner.

What we had as a scrip, pruned down to just setting the owner:

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
my $Attachment = $Transaction->Attachments;
my $AttFirst = $Attachment->First;

my $NewRTOwner = $AttFirst->GetHeader(‘X-NEW-RT-OWNER’);

$Ticket->SetOwner($NewRTOwner);

With ExtractCustomFields I’ve setup the standard scrip with the following template:

|X-NEW-RT-OWNER|.*|$RT::Ticket->SetOwner($value)|

With debug logging lit, the post command is failing saying method SetOwner can’t be called on an undefined value. I can see that $value is getting correct set from the debug leading up to that failure, so I suspect this is a scope error on my part?

Any guidance would be greatly appreciated.

Josh C