[rt-users] Setting Custom Fields upon autocreation of ticket

Jason Fenner jfenner at vitamix.com
Wed Apr 5 15:54:02 EDT 2006


Jared, I just solved that same puzzle myself. Take a look at this 
snippet and see if it helps you out:

unless( $self->TicketObj->FirstCustomFieldValue( '2' ) ) {
my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
Field => '2',
Value => $DefaultValue,
RecordTransaction => $RecTransaction );
unless( $st ) {
$RT::Logger->warning( "Couldn't set $DefaultValue as value for CF :". 
$msg );

--Jason

Jared Hanks wrote:

> Hello,
>
> When a ticket is created via Email with TemporaryAccess in the subject 
> the following scrip runs to create 2 tickets. The second ticket is 
> created and refers to the first ticket.
>
> if($self->TicketObj->Subject =~/TemporaryAccess/i)
> {
> my $TicketObjItem = 
> RT::Ticket->new(RT::CurrentUser->new($RT::SystemUser));
> my $TicketId = $TicketObjItem->Create(Queue => $count, Type => 
> "Ticket", Subject => "Delete Temporary Login", RefersTo => 
> $self->TicketObj->Id);
> }
>
> This is working fine, but I would like set some custom fields in the 
> second ticket. How do I go about this? The custom field ID's of the 
> custom fields I need to set are 37 and 38 and are named TicketType and 
> AccessManagementType. The custom field value ID's are 116 and 119 and 
> are named Access and Separation.
>
> I have tried to use CustomField37 => "Access", CustomField38 => 
> "Separation", and CustomField37 => 116, CustomField38 => 119, but 
> neither has worked. I think this can be done but am just unsure of how 
> to accomplish this.
>
> Any help would be greatly appreciated.
>
> Thanks,
> Jared
>
> _________________________________________________________________
> Don’t just search. Find. Check out the new MSN Search! 
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
>
>
> We're hiring! Come hack Perl for Best Practical: 
> http://bestpractical.com/about/jobs.html
>





More information about the rt-users mailing list