[rt-users] Most efficient way to update custom fields without creating too many transactions

Landon Stewart lstewart at iweb.com
Fri Aug 30 17:09:16 EDT 2013

On 29 August 2013 13:31, Kevin Falcone <falcone at bestpractical.com> wrote:

> Because Custom Fields can hold a LONGBLOB worth of data.
>  Go save a large text CF and look in the database.
> Saving them as 1000 individual values makes 1000 records in the
> database, saving them as 1 large record makes 1 record.  These are
> treated differently on update and display.
> If you follow the advice of the wiki article that was linked to and
> reach around the API, you'll hurt yourself.
> Not recording transactions is orthogonal to the size of the data which
> can be recorded.

I'm sorry - I'm pretty sure I'm reading you correctly but I'm unable to add
multiple values to a Custom Field without creating multiple
ObjectCustomFieldValue records.  Maybe it's not possible to do so.

The %Updates hash is a hash of arrays like this (this is one key, I don't
know why Dumper prints it as two VARs):
$VAR11 = 'Customer';
$VAR12 = [

Here's what I've tried and seen:
foreach my $ufn (keys %Updates) {
    $ticket->AddCustomFieldValue( Field => $ufn, Value => join("\n",
@{$Updates{$ufn}}), RecordTransaction => 0 );
-- What this does is adds one ObjectCustomFieldValue record with \n between
some stuff.  These are displayed in RT as values with spaces between them.

foreach my $ufn (keys %Updates) {
    $ticket->AddCustomFieldValue( Field => $ufn, Value => join(',',
@{$Updates{$ufn}}), RecordTransaction => 0 );
-- I didn't think this would really work but I thought I'd try it anyway.
 Same thing but comma delimited.  They are displayed in RT as values with
commas between them.

So in other words I'm starting to think I've been after something that
can't be done.  RecordTransaction => 0 stops the "Transactions" table from
getting a ton of records added to it (one for each OCFV record added) but I
cannot avoid tons of OCFV records being added.

Landon Stewart :: lstewart at iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130830/773381c5/attachment.htm>

More information about the rt-users mailing list