[rt-users] Setting Custom field on create

Chris Collison collison.chris at hotmail.com
Thu Jul 9 18:33:14 EDT 2009


What I'm trying to do:

When a specific user, id=1101 sends a request to RT I want it to create the ticket as normal, but also set a custom field during the creations process, ie the Severity custom field.  Tickets from this specific user, 1101, will always be assigned the same severity value of 3. The scrip to do this seems pretty simple.  The custom field is a select type, and normally a user creates the ticket on RT webUI and just selects this from the list.  Now we have requests being emailed and need to set the custom field during the creation process.  I didn't create the custom field, but it looks like this:

Select 1 value:
1 Urgent - blahblah
2 High - blahblah
3 Medium - blahblah
4 Low - blahblah

blahblah being the description of each
Custom Condition:
#############################
my $transaction = $self->TransactionObj;
my $ticket = $self->TicketObj;

if (($transaction->Type eq 'Create') &&
    ($ticket->Creator == 1101))
{
    return(1);
}
else
{
    return(0);
}
#############################

Custom Action:
#############################
$Ticket->FirstCustomFieldValue('Severity') = '3'


#############################
This doesn't work. Also tried setting it as '3 Medium - blahblah'.  It seems that this isn't the way to set the customfield.

After reading some posts on here it appears I have to create a custom field by hand and set it somehow.

Something like:

my $cf = new RT::CustomField($RT::SystemUser);
$cf = '3 Medium blahblah'
#set a transaction object of type 'CustomField' to the value of $cf?


Is this how I would go about doing it? Am I on the right track here? Any help would be appreciated!




~Chris


_________________________________________________________________
Lauren found her dream laptop. Find the PC that’s right for you.
http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090709/c97b76e4/attachment.htm>


More information about the rt-users mailing list