[rt-users] Adding a CF with QuickCreate and index.html

alister at gossamer-threads.com alister at gossamer-threads.com
Thu Aug 26 00:16:59 EDT 2010

Hi rt-users,

I want to extend QuickCreate to adjust a CustomField on the homepage.

I was unable to add a CF easily in index.html with the CreateTicket()
Here is what I did to get it working - I'm unsure if its the best way or

After going through RT::Interface::Web::CreateTicket I came up with 
adding the following to Elements/CustomField

(anyone know an automated way to do this?)

    <input type="hidden" value="1"
name="Object-RT::Ticket--CustomField-1-Values-Magic" class="hidden">
    <select id="Object-RT::Ticket--CustomField-1-Values"
        <option selected="selected" value="">(no value)</option>
        <option >Canada</option>
        <option >Europe</option>
        <option >Global</option>

Then in index.html I added 

        my ($t, $msg) = CreateTicket(
            Queue           => $ARGS{'Queue'},
+           'CustomField-1' =>

This returned a RT::Ticket object (I was expecting an Id) and didn't add
the custom field value.
Since I had the ticket I added a bit more that I would normally put in a

    if ($ticket && $ticket->Id) {
        unless ($ticket->FirstCustomFieldValue('Unit')) {
            my ($st, $msg) = $ticket->AddCustomFieldValue(
                Field => 'Unit',
                Value => $ARGS{'Object-RT::Ticket--CustomField-1-Values'},
                RecordTransaction => 0,
            push @results, $msg;

It seems to me like CreateTicket was running RT::Ticket::Create instead of

I think it might have been easier to create an Ticket/Create.html like
Element for the Dashboard.


Should index.html run RT::Ticket or RT::Ticket_Overlay Create?
Has anyone got other suggestions for adding mandatory CF's in QuickCreate?

I am running:
Apache-2.2 mod_perl

Thanks in advance,

More information about the rt-users mailing list