[Rt-devel] Adding Custom Fields to Quick Create

Zodal zodal at centrum.cz
Wed Sep 17 08:16:58 EDT 2008


Hi,

I have found one solution, but it is not clear. I can find the ticket id in
message that is created.


I have added this code to /Elements/QuickCreate :

<tr class="input-row">
<td class="label"><&|/l&>Customer</&>:</td>
<td colspan="3" class="value"><input type="text" size="50" name="Customer"
/></td>
</tr>

and this part to index.html :

if ( $ARGS{'Customer'} )
            {
             my @ids = split(' ', $msg);    # split message with new ticket
info
               my $ticketid = $ids[1];       # get id of newly created
ticket (always on second position)
               my $cf_obj = RT::CustomField->new($RT::SystemUser);
               my $cf_name = "Customer";     # Name of Custom Field
               $cf_obj->LoadByName( Name => $cf_name );
               my $Ticket = RT::Ticket->new($session{'CurrentUser'});
               $Ticket->LoadById($ticketid);
               my ($status, $msg2) = $Ticket->_AddCustomFieldValue(
               Field => $cf_name,
               Value => $ARGS{'Customer'}  
               );
               push @results, $msg2;
             
            }        


I hope this can help or somebody can show me different (clear) way how to do
it.

Thanks,

Z. 


Emmanuel Lacour wrote:
> 
> On Tue, Jul 01, 2008 at 10:04:04AM -0600, Jonathan Jeppson wrote:
>> Hi,
>> 
>> I'm working on adding custom fields to Quick Create on the main page
>> of RT.  I've been wading through code, but I'm having a hard time
>> finding how RT saves the values of Custom Fields to tickets.
>> 
>> Can anyone shed some light or point me in the right direction?  
>> 
> 
> share/html/Ticket/Create.html call share/html/Ticket/Display.html on
> submit, after some processing, then Display.html do little processing
> and pass args to RT::Interface::Web::CreateTicket which call
> RT:Ticket::Create which create the ticket and add the customfields
> values from args.
> 
> my ($status, $msg) = $self->_AddCustomFieldValue(
> [...]
> _______________________________________________
> List info:
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
> 
> 

-- 
View this message in context: http://www.nabble.com/Adding-Custom-Fields-to-Quick-Create-tp18220450p19530792.html
Sent from the Request Tracker - Dev mailing list archive at Nabble.com.



More information about the Rt-devel mailing list