How to know if a ticket was created via email or via RT Web GUI

We want to make some statistics regarding our customers way of creating tickets: via email or via RT web portal. We searched for an automatic way to extract this information but did not find one.
The usernames of our customers have the same value as their email address, so the Requestor has the same value regardless which method they used to create a ticket; therefore we cannot use Requestor as discriminator.
Then we thought we found a solution when we added a custom field ''Created via RT GUI" with single value “Yes” which would have values:

  • ‘no value’ when ticket is created via email
  • ‘Yes’ when ticket is created via RT GUI
    The problem is that we process tickets created by Customers (via email) using RT GUI (i.e. we follow the workflow until they are closed), and any web modification on the ticket will override the custom field ‘no value’ with ‘Yes’ and we’re back to square one. Of course we could add options like ‘Yes’ or ‘No’ but the point is to make this process automatic and avoid relying on user input on this which would be error prone.

Please let me know if you know about other options to automate this detection.


If you look at the headers for transactions you can see X-RT-Interface header which will say Web, Rest or Email. So you can look at the create transaction (first one) and see how it was created. You could also have a scrip that runs On Create and checks the header and sets a custom field on the ticket for how it was created


Thanks for your quick answer.
We like the last idea, which is to create a scrip which sets a custom field value on create ticket, based on value of header X-RT-Interface. In some pseudo-code, this would be:
if ( = ‘Web’)
then = ‘Created via Web’

Please correct me if the scrip parameters are not the following (we are using RT 5.0.1):

  • Condition: On Create
  • Action: User Defined
  • Template: Blank
  • Applies to: Global
    User Defined Conditions and results:
  • Custom condition: empty
  • Custom action preparation code: return 1;
  • Custom action commit code: ???

As you can see I’m not experienced with RT scrip code in Perl, can you please provide more details on how to write this code?

Looks like the web site miss-formatted my “pseudo-code” because I used some illegal characters. What I wrote was something like:
if (transaction header X-RT-Interface = ‘Web’) then (My Custom Field Value = ‘Created via Web’)


Gets you the header and then you can set a CF via $self->TicketObj->AddCustomFieldValue(Field => 'some name', Value => 'Some Value' );

Thanks again, it worked.
In RT I defined a custom field ‘Created via RT GUI’ with two options (Yes and No) and default value Yes. When ticket is created by web, the custom field will take the default value Yes.

Then I added this scrip for tickets created by Email:

my $header = $self->TransactionObj->Attachments->First->GetHeader(‘X-RT-Interface’);

if ($header eq ‘Email’) {
$self->TicketObj->AddCustomFieldValue(Field => ‘Created via RT GUI’, Value => ‘No’ );

return 1;

The result is that the custom field now contains the correct value Yes or No without user intervention.

1 Like