[rt-users] ExtractCustomFields for Ticket values

Landon Stewart lstewart at iweb.com
Tue Sep 1 16:29:36 EDT 2015


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 at staff.gwi.net<mailto:jcoombs at 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 at staff.gwi.net<mailto:jcoombs at 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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150901/14c9259b/attachment.htm>


More information about the rt-users mailing list