How to access X-RT-Interface header from On Create scrip?

I am trying to access the new X-RT-Interface header in order to
determine within a Scrip if a ticket was created via Email or Web.
However whenever I try to create a new ticket and use an On Create scrip
to read this header, I get errors saying "Can’t call method “GetHeader"
on an undefined value”.

Can anyone please provide an example of how to properly access this header?

Thank you!

Hello,

I don’t know if an elegant solution using X-RT-Interface is possible, but I
can give a workaround. This is the custom condition we use to separate
ticket creation from web and mail:

# Custom condition to notify when a ticket is created from e-mail
# Based on "OnCreateFromEmail"
# http://requesttracker.wikia.com/wiki/OnCreateFromEmail

my $trans = $self->TransactionObj;
return 0 unless $trans->Type eq "Create";

my $msgattr = $trans->Message->First;
return 0 unless $msgattr;

return 0 unless $msgattr->GetHeader('Received');
return 1;

I hope it helps.2015-07-07 3:16 GMT+02:00 Russell Jones russell@jonesmail.me:

I am trying to access the new X-RT-Interface header in order to determine
within a Scrip if a ticket was created via Email or Web. However whenever I
try to create a new ticket and use an On Create scrip to read this header,
I get errors saying “Can’t call method “GetHeader” on an undefined value”.

Can anyone please provide an example of how to properly access this header?

Thank you!

1 Like