How can I automatically put a value from Body into a custom filed?


#1

What i’m trying to achieve. RT gets a letter containing a string

Birth date : xx/xx/xxxx

BUT, i need a simple and reliable way to do it.
Has someone done it before ?


#2

I suggest you use a regular expression to read the text in a Scrip that will be called On create
something like :

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;

my $content = $Transaction->Content;
$content =~ /(.)Birth date : (.)/s;
my $bdate=$2;
my $CF = RT::CustomField->new( $RT::SystemUser );
$CF->LoadByNameAndQueue( Name => ‘Birth date’, Queue => $Ticket->Queue );
$CF->AddValueForObject( Object => $Ticket, Content => $bdate);

The regular expression WILL need to be adjusted to something that matches your text. I also see some stars are removed but if you understand how regex’s work you shouldn’t have a problem fixing it.


#3

I do this all the time using ExtractCustomFieldValues.