[rt-users] Auto-creating a 'dependant' ticket On Transaction

Franzini, Gabriele [Nervianoms] Gabriele.Franzini at nervianoms.com
Thu Dec 10 10:09:13 EST 2009


Hi Jonathan,

After the code for creation of dependent ticket,

> my $new_tkt = RT::Ticket->new($RT::SystemUser); my ($id, $msg) = 
> $new_tkt->Create(
>      Queue => "Data Analysis",
>      Subject => $tkt->Subject,
>     Status => 'new',
>     Requestor => $requestors,
>     DependedOnBy => $tkt->Id);

Try to add something like this one:

my $CFName = "Your CF NAME goes here";
my $ValueToAssign = "Your VALUE goes here";
my $RecTransaction = 1;
my $QueueObj = $new_tkt->QueueObj;
my $CFObj = RT::CustomField->new( $QueueObj->CurrentUser );
$CFObj->LoadByName( Name => $CFName);
my( $id, $msg ) = $new_tkt->AddCustomFieldValue(
                   Field => $CFObj->id,
                   Value =>  $ValueToAssign,
                   RecordTransaction => $RecTransaction );

Hope it helps, Sorry but I have no time to test it...
Gabriele

------------------------------

Message: 3
Date: Tue, 8 Dec 2009 14:46:49 -0800 (PST)
From: Jonathan Rummel <jrummel at imapp.com>
Subject: Re: [rt-users] Auto-creating a 'dependant' ticket On
	Transaction
To: rt-users at lists.bestpractical.com
Message-ID: <26702202.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Gabriele,

It works perfectly!  Thanks!  That's just what I needed!

Do you have any idea how to refer to a Custom Field within the newly
created ticket?  Ex:

$new_tkt->Create(
     Queue => "Data Analysis",
     Subject => $tkt->Subject,
    Status => 'new',
    CUSTOM FIELD => "VALUE",  <== (what's the proper syntax here for
setting the new ticket's cf value?)
    Requestor => $requestors,
    DependedOnBy => $tkt->Id);

Thanks again!
Jonathan




More information about the rt-users mailing list